![]() ![]() The -jar option requires the use of a manifest and the relative paths to dependencies should be listed in this file. The -jar and -cp/-classpath options are mutually exclusive. ![]() The command line options for java can be found here. S-0.2.2.jar jdic_plus_native-0.2.2.jar jtds-1.2.2.jar xstream-1.3.1.jĪr xpp3_min-1.1.4c.jar commons-net-2.0.jar text_processing-2.5.7-SNAPĪlternatively, use Maven, it's loads better at this kind of stuff! With all these entries in the manifest I can specify java -jar db_field_cleaner.jar and all the other jars are inlined into the classpath : Manifest-Version: 1.0 You need to specify all the other jars that are required in your classpath in the manifest file before you can execute java -jar my-test.jar, here is a copy of one of my manifest files. So move your JarRunner into a package, and declare it appropriately in the element. If your main class is in the default package (the unnamed package), I am not sure it can be referenced by the loader (see this SO question) The needs to specify the full path (packages) of the MainClass, not just MainClass. or may not define adequately the MainClass within your 'my_jar.jar'.The best solution when you have a jar is to try to include the required jars into the manifest declaration. may not have a complete classpath Class-Path: see this HowTo.The error seems actually related to your MANIFEST which: I moved my java classes to a server and referenced the MainClass with the server in the manifest attribute, but that didn't fix anything. If I comment out the code that instantiates the missing classes but leave the imports, the code executes fine. it solves the first error but a different error comes up:Ä®xception in thread "main" : org/apache/log4j/LoggerĪt .TServerSocket.(TServerSocket.java:36) Here are the things I've tried so far that don't work:Īdding a flag on the command line like "java -cp /usr/local/lib/libthrift.jar -jar my_jar.jar", the result is the same error as aboveĪdding inside my jar's manifest> tag, the result is the same error as aboveĪdding -Xbootclasspath/a:/usr/local/lib/libthrift.jar./ to the java command line., I get the error: Exception in thread "main" ****: org/apache/thrift/transport/TTransportExceptionĬaused by: : .TTransportExceptionĪt $1.run(URLClassLoader.java:200)Īt (Native Method)Īt (URLClassLoader.java:188)Īt (ClassLoader.java:307)Īt $AppClassLoader.loadClass(Launcher.java:301)Īt (ClassLoader.java:252)Īt (ClassLoader.java:320)Ĭould not find the main class: **Målass**. When I try running the program via: java -jar Målass.jar java file imports a bunch of thrift packages such as .TTransportException. My classpath for javac contains only " /usr/local/lib/libthrift.jar" and the main. ![]() It seems like this comes up a lot but none of the related questions' solutions worked for me. I'm using ant to build my build.xml file, it compiles ok, but then getting a runtime when running the resulting jar via " java -jar my_jar.jar". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |