0

Originally, I was able to run my code from command line as such:

java -cp "/var/www/html/tcqa/bin/test_and_control-1.0-SNAPSHOT.jar:/var/www/html/tcqa/bin/postgresql-9.3-1100-jdbc41.jar" Main /var/www/html/tcqa/sql/tc.sql

I needed to add some new functionality and decided to break out the main class and use case to manage which sql statement would get run. I moved my main class out and have not been able to get my code to run from command line. My new command line looks like this:

java -cp ["/home2/smontoya/test_and_control-1.0-SNAPSHOT.jar:/var/www/html/tcqa/bin/postgresql-9.3-1100-jdbc41.jar;"] Main email /var/www/html/tcqa/sql/email.sql

Obviously I want to test this before moving it into production mode. My code structure looks like this:

main
|-->java
    |--> email
    |    |__ EmailFlag
    |    |__ EmailRow
    |--> tc
    |    |__  Analytics
    |    |__ Row
    |    |__  TestAndControl
    |    |__  Utils
    |--> Main
2
  • Post the error you are getting Commented Dec 3, 2014 at 16:42
  • I found the solution. The problem is that the two jar files were NOT in the same location. One was located in my bin directory and another was in another completely different location (directory structure). After the two jar files were in the same directory the main error went away... Commented Dec 8, 2014 at 14:22

2 Answers 2

1

Please check your manifest file in the jar.. It describes the version and mainClass. If you are using maven .. While adding dependencies to build jar describe the main class in configuration so that maven will add this configuration to manifest file

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

2 Comments

Also as mentioned by stackdev u can give main class namw with package as classpath
The problem turned out to be that the two files were not in the same directory location. After I placed the two files in the same directory location everything worked fine.
0

Try specifying fully qualified name of the Main:

java -cp /path1:/path2 com.company.Main arg1 arg2

Comments

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.