.jar garbled output on web browser when downloaded - deployment

I deployed my .jar file to the web server and attempted to download the .jar file using the old Nokia phone via its web browser. Upon finishing downloading, a garbled output is displayed on the web browser instead of prompting for installation. What went wrong? Do I have to create some sort of installation file for my .jar application? Thanks.

A MIDlet is a combination of a jad and jar file. While some browsers permit direct installation of the jar, one would usually point a browser to the jad to install.
And ensure the MIME types are set correctly.
jads need a MIME type of text/vnd.sun.j2me.app-descriptor, and jars are application/java-archive.

Related

Install4J - hide .jar file from installation directory?

I am currently working on turning my java application into a windows installer, converting the .jar into and .exe file.
Have chosen Install4J because of the ability to bundle JDK with the application, as well as recognizing previous installations when deploying updates.
Only problem I have, is the fact that the jar file for the application, is saved in the installation directory as well.
Does anyone know how to fix this? I don't want the original jar file in the directory, just the converted exe file.
The .exe file is just a launcher for the JVM, it does not contain natively compiled Java code.
The best way to protect your code is to use an obfuscator like ProGuard.

Issue with deploying GWT app to tomcat in eclipse

Following this tutorial, I could execute GWT app using eclipse. I could access the app at http://127.0.0.1:8888/De_vogella_gwt_helloworld.html?gwt.codesvr=127.0.0.1:9997.
Then, I googled to find a way to deploy the app to tomcat, and I found this site. It has two step way to exporting GWT app to tomcat.
Exporting the src directory into jar file.
Using ant create a war file.
I copied the hello.war file into /Library/Tomcat/webapps, and open the browser with localhost:8080/hello to get this error.
When I click the HTML file in webapps directory, so I think something's wrong with the packaging.
What might be wrong?
You need to compile your GWT app to run in production mode. See this section of the GWT doc for detailed steps (for GWT 2.4).
From David's answer, I could get it working.
I had to compile the application again.
to get it working.

gwt beginner- getting error when I make an RPC call on server- same code works in gwt dev mode

I have created a simple gwt application (with gwt 2.4) that makes a single RPC call.
When I run this in GWT Dev mode, it runs fine, however when I try to run this on a server-
this is the message that I get --
POST http://app.sparkcrawler.com/com.arvindikchari.auth.App/AuthenticationService 404 (Not Found)
I have copied all files from the WAR folder in my Eclipse GWT project, to the web server's folder. The web server uses Tomcat 5.5(with Cpanel control panel). I copied these files, after successfully compiling the files ("GWT Compile Project")...
What have i done wrong here? Have i missed some files? I have copied everything from war folder, including "WEB-INF" folder and its contents, to the web server.
I think, copying the Eclipse project's WAR folder is not the appropriate way to deploy a GWT application to a server.
You first have to compile for production mode (see Understanding the GWT compiler), then with the resulting JavaScript files, create a WAR including server side classes which you can deploy to a Tomcat server. (See Deploy a GWT Application)
You can use Ant or Maven to automate this process.

hosting GWT project

What do i need to upload from my gwt project to web hosting?
its just html or all project files?
Any modern Java IDE gives you an option to export a web project as a war module. If your are not using an IDE, it depends:
If you just write your code under client folder, no need to upload any .class files to the server. You don't need any Java Application server as well, and a normal HTTP server (such as Apache) would suffice. An example of such a GWT application is GWT showcase which is included in GWT download package.
If you have any server-side code under server package, then you should upload .class files (under WEB-INF/classes folder in your web modile) as well as the rest of .js, .css, .jpg/gif, .html files. In this case you need a servlet container such as Tomcat to serve your server-side code.
You'll only need to upload the html files, the css files, and your java file. Also, any other file linked to within your html files need to go in the same directory.

Problems deploying WAR file from Netbeans to Tomcat

I'm trying to configure build.xml files for build forge, but it seems like I am having trouble with the libraries required for the java servlet pages. I am actually trying to use OWASP's AntiSamy library but I keep getting a Policy Exception followed by a file not found
org.owasp.validator.html.PolicyException: java.io.FileNotFoundException: C:\Program%20Files \Apache%20Software%20Foundation\apache-tomcat-6.0.29\webapps\XSSDemo\WEB-INF\classes\...\antisamy.xml (The system cannot find the path specified)
The antisamy.xml file is definitely in this location, however.
So I tried using Netbeans to clean and build a WAR file that I would have expected to work, since the web app works fine when I run it through Netbeans. However, I get the same problem. Is there possible some reference that Netbeans is creating when I run the app through the ide that is not occurring in the WAR deployment? Could the URL Encoding in the antisamy.xml location be causing problems?
Thanks for the help.
Edit: I compressed the long class path into the three dots here. The actual response has the actual class path. I am not getting any kind of security errors.
The problem I had was not actually with the deployment--it was the file reference itself in my java servlet. The encoding in the path '%20' in the Program Files folder caused a FileNotFoundException. The reason this did not occur in netbeans is because the deployed files are in a c:\users... folder and there are no spaces to be encoded. The also explained why the application ran well on other computers with their tomcat folders directly on the root directory. This is the actual solution to my problem. Thanks for all your help.