Results 1 to 19 of 19
- 02-22-2010, 09:30 AM #1
setting class-path & Library Path in ubantu
how to set classpath of a jar and librarypath of .so file in Ubantu ?
i have a "abc.jar" file that i have to put into CLASSPATH.
AND a native library "xyz.so" that i have to put into library path ..
I was setting paths in project builds in Eclipse , but nothing worked out .
now i want to run program out of eclipse.so how to set all these paths..
- 02-22-2010, 09:32 AM #2
When i execute Hi.java following happens. i am unable to use the "com.asprise.util.ocr"
Java Code:sandeep@training-pc1:~$ javac Hi.java Hi.java:7: package com.asprise.util.ocr does not exist import com.asprise.util.ocr.OCR; ^ Hi.java:25: cannot find symbol symbol : class OCR location: class Hi String s = new OCR().recognizeCharacters(image);
- 02-22-2010, 10:38 AM #3
Anybody ?
nobody !!
- 02-22-2010, 10:43 AM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
You set the classpath using the -cp flag for both the javac and java commands.
You set the library path using the -Djava.library.path flag to the java command.
Also read this thread:
http://www.java-forums.org/eclipse/2...-lib-file.html
- 02-22-2010, 11:01 AM #5Java Code:
javac -classpath /home/sandeep/Downloads/Asprise/aspriseOCR.jar Hi.java
Java Code:Exception in thread "main" java.lang.NoClassDefFoundError: com/asprise/util/ocr/OCR at Hi.main(Hi.java:25) Caused by: java.lang.ClassNotFoundException: com.asprise.util.ocr.OCR at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 1 more
Also read this thread:
want to add Asprise jar file as well as its lib file
- 02-22-2010, 11:09 AM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
There is nothing wrong with the library path.
Did you get the correct asprise.jar or are you still trying to use the one that you (incorrectly) created?
- 02-22-2010, 11:14 AM #7
no m not using the one i made yesterday .. i have got aspriseOCR.jar already packaged , that i have downloaded .... when i tried these stuffs on windows .. it worked
but something wrong when m doing in linux ubantu
- 02-22-2010, 11:18 AM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
Did you add the cp flag to the java command too like I said above?
Post your full run command.
- 02-22-2010, 11:25 AM #9Java Code:
sandeep@training-pc1:~$ javac -cp /home/sandeep/Downloads/Asprise/aspriseOCR.jar Hi.java sandeep@training-pc1:~$ sandeep@training-pc1:~$ sandeep@training-pc1:~$ java -cp /home/sandeep/Downloads/Asprise/aspriseOCR.jar Hi.java Exception in thread "main" java.lang.NoClassDefFoundError: Hi/java Caused by: java.lang.ClassNotFoundException: Hi.java at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: Hi.java. Program will exit. sandeep@training-pc1:~$
- 02-22-2010, 11:27 AM #10
can i extract the jar to get the class files and then put those class files in the local directory of my program, ie all the classes in the same directory, and then run it .. wht say ?
- 02-22-2010, 11:28 AM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
You don't run .java files, you run .class files.
When running the .class files you simply give the name of the class without the .class extension. These are basics that you should have read about before you wrote your first java program.
- 02-22-2010, 11:32 AM #12
yaah man ... i know these ...
Java Code:sandeep@training-pc1:~$ java -cp /home/sandeep/Downloads/Asprise/aspriseOCR.jar Hi Exception in thread "main" java.lang.NoClassDefFoundError: Hi Caused by: java.lang.ClassNotFoundException: Hi at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: Hi. Program will exit. sandeep@training-pc1:~$ ^C sandeep@training-pc1:~$
- 02-22-2010, 11:34 AM #13
the instruction in READ ME file are :
♦ Put aspriseOCR.jar into your class path, and
and for libAspriseOCR.so file , <native library>
♦ Put the native library into the library path.
wht will the scholar do ?
- 02-22-2010, 11:41 AM #14
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
No you don't know these. That is why you are having problems.
You also can't read the responses I'm posting.
1.) You also need to have the folder containing the Hi.class file on the classpath as well.
2.) You still didn't specify the library path.
- 02-22-2010, 12:02 PM #15
appreciate your time for the thread .. but problem is also unidentified by you ... it is somethng else. . coz i think i have tried all the flags and combinations.. but its still unsolved.
- 02-22-2010, 12:04 PM #161.) You also need to have the folder containing the Hi.class file on the classpath as well.
2.) You still didn't specify the library path.
- 02-22-2010, 12:19 PM #17
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
No it's not. You need to add it (.) the current directory but I guess I'm wasting my time here because you think that I'm wrong even though I'm trying to give you free help.
Thank you for (indirectly) asking me not to reply to you.
- 02-22-2010, 12:30 PM #18Thank you for (indirectly) asking me not to reply to you
come on .. dude !!! its not like that ....i appreciate ur time and help !! but u know i m stuck from more than 2 day on these stuff . understand.... i dint meant that ..
its only becoz m done with today's work .... now no more till 2morro
- 02-22-2010, 12:31 PM #19
Similar Threads
-
Setting path under Linux to recognize jre
By cccccc in forum New To JavaReplies: 4Last Post: 03-31-2009, 06:51 AM -
URGENT: How to include a library in Java class path?
By gsmurthy30 in forum New To JavaReplies: 3Last Post: 09-15-2008, 04:58 PM -
URGENT: How to include a library in Java class path?
By gsmurthy30 in forum Advanced JavaReplies: 1Last Post: 09-15-2008, 08:39 AM -
Setting up class path for Eclipse
By tsantana in forum EclipseReplies: 1Last Post: 04-07-2008, 07:05 PM -
Setting Java Path
By bugger in forum New To JavaReplies: 2Last Post: 11-22-2007, 09:48 AM
Bookmarks