0

I am having a java project having the directory structure as java->applet and a few .java files

the applet folder further contains two folders and some .java files

I need to develop a jar file out of this project

I did so by writing the command line

jar cvfm myfile.jar *.java
(obviously by moving into corresponding directory)

when I checked by extracting the file(it was zipped as a Nokia application installer file) it showed me only the classes in the applet folder not the folders in it

moreover i needed to use this jar file in a jquery plugin where i had written

var dasherApplet = $('applet');

dasherApplet.attr({
    'height':'100%',
    'width':'100%',
    'archive':farfalla_path+'plugins/dasher/jardasher.jar',
    'code':'JDasherApplet.java'
});

but it showed me the class not found exception

for this I checked the previous versions of the java applet; there the java files were replaced by .class files so i tried compiling a java file into .class by using the command line

C:/>javac filename.java still all in vain this time it showed me "cannot find symbol" error

what was interesting was that the errors generated were imitating the java files present in the same folder. I navigated to the directory where the file was stored still the same error when i tried to simply run it by using java filename.java error was main class not found:JApplet.java

Please help me develop this applet

2
  • Do you have a public static void main(string[] args) {...} function in your filename.java class? Commented Jun 8, 2011 at 16:28
  • No it does not contain the required function. How can I add one.. what to write in it Commented Jun 8, 2011 at 16:33

1 Answer 1

2

Firstly you need to compile all the jar files before running.

Secondly , you CANNOT run Applets using java filename.java .

As this link explains http://download.oracle.com/javase/tutorial/deployment/jar/build.html ,

jar cvf TicTacToe.jar TicTacToe.class audio images

Here audio and images are folders , so that is how you add folders to jar.

Also .jar files are not Nokia Application Installer files . Nokia simply associates them for installing apps (that is J2ME)

Sign up to request clarification or add additional context in comments.

3 Comments

it is giving me this error javac: invalid flag: C:\filename.jar
may i seek further attention please
You cannot compile jar files but you have to individually compile all the .java files and then pack them into a jar and add a MANIFEST

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.