• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java, how to set path in cmd?

 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I rewrite java.lang.Class.java and compile it to class.jar.
Now I want to run the simple HelloWorld program using java.lang.class in class.jar. how to do this?
Thanks very much.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jing hu wrote:I rewrite java.lang.Class.java and compile it to class.jar.
Now I want to run the simple HelloWorld program using java.lang.class in class.jar. how to do this?
Thanks very much.


I hope you realise you have just broken the terms of the license you agreed to when you installed the JDK
D. Java Technology Restrictions. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need your java.lang.Class (not the one from java) to be found by the compiler & jvm ?
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.

I modify the java.lang.Class. I want to record something.
how to let jvm load the special java.lang.Class?
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to change java.lang.Class???
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Why would you want to change java.lang.Class???
Agree. That may be in breach of the JVM licence, too. You would have to write your own JVM to use your new class.

Too difficult a question for beginners: moving.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know the Class.forName(str) information in one java application.
So I modify the forName and add some listener.
If you have a better suggestion for this. you can tell me.
tks.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Rob Prime wrote:Why would you want to change java.lang.Class???
Agree. That may be in breach of the JVM licence, too. You would have to write your own JVM to use your new class.

Too difficult a question for beginners: moving.


why it is difficult?
In Eclipse, I can set vm arguments : -xbootclasspath/p:class.jar . it will load the classes in the class.jar firstly.
But I don't know how to do this in the command line.
I only want to know how to do this in the command line. using Eclipse I have let jvm load the classes from class.jar successfully.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote: That may be in breach of the JVM licence, too. You would have to write your own JVM to use your new class.


I use harmony jre. It is licensed to the ASF(Apache Software Foundation) . So I think I can modify java.lang.Class.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:
I hope you realise you have just broken the terms of the license you agreed to when you installed the JDK
D. Java Technology Restrictions. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation.


I think modifying harmony JRE will be ok since it is under ASF license.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jing hu wrote:
Joanne Neal wrote:
I hope you realise you have just broken the terms of the license you agreed to when you installed the JDK
D. Java Technology Restrictions. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation.


I think modifying harmony JRE will be ok since it is under ASF license.


You don't use harmony to create the class file, you use a JDK - in your case I presume you use Eclipse as you mentioned it earlier. You probably need to check your Eclipse license to see what's allowed.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jing hu wrote:why it is difficult?
It is not the sort of thing a beginner would think about. We reserve the beginner's forum for easy questions.
 
salvin francis
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Off to a different topic ...........

Isnt it more simpler to create your own class that acts as a library with a unique forName method ?

eg:


?

It would save the liscensing too and would not be jvm dependent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic