ram_0218
asked on
Java Jar issue.
I hate to ask this question but I wasted too much of a time on this one. I mean from morning I'm trying to work it out.
I've a jar file xyz.jar which has a swing application in it. the person who wrote the code he hardcoded the ip address of the oracle machine/what i did is i used jad to extract the java file out of this jar and replaced the ip and created the jar again. so far so good.
but my modified class does not effect in the outcome if i execute it.
secondly, its weird but i know i screwed my desktop. i wrote a batch script which invokes the jar file with javaw command / if i click on jar file directly it opens up the swing application but if i click the script file it says unable to find main class. question here is: when i open jar it knows the main class but when i call it using javaw it struggles to find the main class. whats the reason here?
Thanks for all your time -
I've a jar file xyz.jar which has a swing application in it. the person who wrote the code he hardcoded the ip address of the oracle machine/what i did is i used jad to extract the java file out of this jar and replaced the ip and created the jar again. so far so good.
but my modified class does not effect in the outcome if i execute it.
secondly, its weird but i know i screwed my desktop. i wrote a batch script which invokes the jar file with javaw command / if i click on jar file directly it opens up the swing application but if i click the script file it says unable to find main class. question here is: when i open jar it knows the main class but when i call it using javaw it struggles to find the main class. whats the reason here?
Thanks for all your time -
> if i click the script file it says unable to find main class
how are you using the javaw command? if you aren't already, try using the -jar in the command like this:
javaw -jar xyz.jar
how are you using the javaw command? if you aren't already, try using the -jar in the command like this:
javaw -jar xyz.jar
Please post the script file too
ASKER
CEHJ,
the person didnt put the source codes in the jar so what I did is:
first unzipped the jar:-
jar xvf name.jar
Then went into the folder pack1\subpackage\file.clas s
used jad to convert into java
just modified the ip
compiled and generated file.class again in the same folder
updated the jar back - used
jar uvf pack1 //so it updated the modified class file which i could see after opening the jar in winzip
the person didnt put the source codes in the jar so what I did is:
first unzipped the jar:-
jar xvf name.jar
Then went into the folder pack1\subpackage\file.clas
used jad to convert into java
just modified the ip
compiled and generated file.class again in the same folder
updated the jar back - used
jar uvf pack1 //so it updated the modified class file which i could see after opening the jar in winzip
sounds to me that while creating the archive you missed MENIFEST.MF file that has notion of the main class.
ASKER
hi,
my javaw command looks like
javaw -classpath "c:\ojdbc14.jar;c:\mythisa pp.jar" pack1.subpackage.main
pls note, if i open mythisapp.jar directly by double clicking from explorer it opens up. but if i put the above comment its not working.
when i open it directly its failing due to oracle classpath not found because i believe i didnt set that ojdbc14.jar in my classpath
java defines what puzzle means. pls help.
my javaw command looks like
javaw -classpath "c:\ojdbc14.jar;c:\mythisa
pls note, if i open mythisapp.jar directly by double clicking from explorer it opens up. but if i put the above comment its not working.
when i open it directly its failing due to oracle classpath not found because i believe i didnt set that ojdbc14.jar in my classpath
java defines what puzzle means. pls help.
ASKER
hi. after creating the jar file, I extracted the manifest file by using WINZIP and it correctly reads as:
Manifest-Version: 1.0
Main-Class: pack1.subpackage.main
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.6.2
X-COMMENT: Main-Class will be added automatically by build
so the main class is pretty much there.
Manifest-Version: 1.0
Main-Class: pack1.subpackage.main
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.6.2
X-COMMENT: Main-Class will be added automatically by build
so the main class is pretty much there.
>>
if i open mythisapp.jar directly by double clicking from explorer it opens up .............
when i open it directly its failing due to oracle classpath not found
>>
I'm getting confused...
if i open mythisapp.jar directly by double clicking from explorer it opens up .............
when i open it directly its failing due to oracle classpath not found
>>
I'm getting confused...
>>so the main class is pretty much there.
It'd have to be or it wouldn't start by double-click
It'd have to be or it wouldn't start by double-click
ASKER
NO-
The applicatoin comes up when double clicking - the swing appln displays and when i enter comments it tries to hit the Database and there its failing due to the missing classpath (in log it says classnotfoundexception: oracle.jdbc.odbc.jdbcodbcd river)
If i try to launch the application with the script I wrote, its not even opening the swing application. instead it displays a dialog box "Could not find the main class! Program will exit now!"
The applicatoin comes up when double clicking - the swing appln displays and when i enter comments it tries to hit the Database and there its failing due to the missing classpath (in log it says classnotfoundexception: oracle.jdbc.odbc.jdbcodbcd
If i try to launch the application with the script I wrote, its not even opening the swing application. instead it displays a dialog box "Could not find the main class! Program will exit now!"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I couldnt! Because the person who built that jar, I believe he used JSDK 1.5 for building/coding. I've only 1.4 JSDK when I say:
java -jar mythisapp.jar
Exception in thread "main" java.lang.UnsupportedClass VersionErr or.
40 mins back I just installed JVM 1.5 then only it started running in my machine.
java -jar mythisapp.jar
Exception in thread "main" java.lang.UnsupportedClass
40 mins back I just installed JVM 1.5 then only it started running in my machine.
Use the same path to java.exe as to javaw.exe - you should have both there
ASKER
HI,
I did this:-
set path=c:\jvm1.5\bin
//so here i've path set to 1.5's bin
set classpath=c:\ojdbc14.jar;. ;
now launching the app as
java -jar myfirstthis.jar
it correctly launches but in logs i get
::java.lang.ClassNotFoundE xception: oracle.jdbc.driver.OracleD river
why? i've it in my classpath, wont it go in that java cmd? or to that swing app ?
I did this:-
set path=c:\jvm1.5\bin
//so here i've path set to 1.5's bin
set classpath=c:\ojdbc14.jar;.
now launching the app as
java -jar myfirstthis.jar
it correctly launches but in logs i get
::java.lang.ClassNotFoundE
why? i've it in my classpath, wont it go in that java cmd? or to that swing app ?
ASKER
its bit confusing. if i open myfirsthis.jar in winzip there too in lib folder they have this same jar file. why should i be setting extra classpath here.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
man.........looks to me its working
great. i've no clue why javaw doesnt work but java works. but heck, i got it working. large enough, i'm not gonna touch java in future.
thanks guys/if anyone has time post me why it wasnt working with javaw.
thanks everyone for sorting it out in an hour time which i should've done in the morning only.
great. i've no clue why javaw doesnt work but java works. but heck, i got it working. large enough, i'm not gonna touch java in future.
thanks guys/if anyone has time post me why it wasnt working with javaw.
thanks everyone for sorting it out in an hour time which i should've done in the morning only.
:-)
Do you mean that or do you mean the class file?