Win a 3 month subscription to Marco Behler Videos this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

import java file  RSS feed

 
Philippe Ponceblanc
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm programing a little program : i have created a file philo.java, it's a library, i want to call philo.java since hello.java, a try more solutions,
for example import philo.java into hello.java, also a don't anderstand the class path ?
I work under linux (debian 8), my question is how can i do for serv philo.java since hello.java, i use drjava like IDE.

Regards
philippe
 
Norm Radder
Rancher
Posts: 2052
26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by reading the tutorial on paths: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Bascially: The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37051
507
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YOu'll also need to learn about packages. To import a class, it needs to be in a package.
 
Philippe Ponceblanc
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your answers is on ms windows, not for linux, just a little:
i hope to see an example of code, my files are on a same repertory >>> /home/phipo/prog-java !
i don't have to set the class path of jdk under linux, i do before this time.
please give me an example !

regards
philippe
 
Norm Radder
Rancher
Posts: 2052
26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the class files are not in packages and are in the same folder, there is no need for an import statement.  The classpath defaults to the current directory.
 
Philippe Ponceblanc
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my question is not for reading a lot of information (is not easy for me to translate)
i want just a sample !!!
 
Norm Radder
Rancher
Posts: 2052
26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need.  Put the class files in the same folder and enter:
java TheClassName
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!