0

I have a an application that acts in a certain way, when it is executed it uses the current class path set for java executable but unfortunately it doesn't make it the application work like it should, But when I alter this path by adding just an extra character the application works perfectly fine,

So I believe the application bypasses using the path which is why it works fine with an altered java class path. But the problem is some one else is using this path for their own application in other words i can only temporarily alter this path and will always have to put it back to the normal path.

But What I am thinking is that there should be a way for me to be able to create a file that has the Java Path inside which I could put in the folder when this application executes with this instead of the application looking at the first class path it only looks at the one in the folder.

Any idea on how this can be done ? Many thanks in advance.

2 Answers 2

2

When you execute your application, you can set the classpath:

java -cp ..... -jar my.jar

You don't need to set global variables at all. See the java manual.

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

Comments

1

Not sure if I get you right but this is something that the Manifest.mf file should contain... Here is example:

Manifest-Version: 1.0
Built-By: xxx
Build-Jdk: 1.7.0_17
Class-Path: lib/some1.jar lib/some2.jar
Created-By: Apache Maven 3.0.4
Main-Class: full.qualified.main.class.name
Archiver-Version: Plexus Archiver

The class-path variable is responsible for passing the right class path to the application.

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.