Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Importing external .java files on a java project in eclipse?
New Posts  All Forums:Forum Nav:

Importing external .java files on a java project in eclipse?

post #1 of 2
Thread Starter 
Hey guys,

My teacher gave us a project and we're only required to hand in one class file. He also gave us a folder (not a project) of .java data structures and interfaces (BST, lists... Stuff like that).

We get to choose which data structure we use for the project, but I'm having trouble importing the data structure (LBST) I would like to use.

Can anyone help?

Cheers
Griever
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570K ASUS P8Z77-V Deluxe MSI R7950 Twin Frozr 3GB Corsair Vengeance 16GB 1600Mhz 
Hard DriveCoolingOSMonitor
OCZ Vertex Plus 120GB Corsair h100 Windows 7 Professional Asus VS228H-P 21.5In 
KeyboardPowerCase
Razer Black Widow Ultimate Corsair AX850 NZXT Switch 810 White 
  hide details  
Reply
Griever
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570K ASUS P8Z77-V Deluxe MSI R7950 Twin Frozr 3GB Corsair Vengeance 16GB 1600Mhz 
Hard DriveCoolingOSMonitor
OCZ Vertex Plus 120GB Corsair h100 Windows 7 Professional Asus VS228H-P 21.5In 
KeyboardPowerCase
Razer Black Widow Ultimate Corsair AX850 NZXT Switch 810 White 
  hide details  
Reply
post #2 of 2
Do you have the project already in a folder in the directory of your workspace then it is a matter of copying in the .java files and what not into the folder and refreshing the project in Eclipse. If the Project is already in Eclipse then it is a matter of just copying them in and refreshing the project in Eclipse.

If you don't have a project created with Eclipse. I would suggest taking the raw .java files and first creating a Java Project with Eclipse IDE on whatever version of Java you need either 1.6 or 1.7, and then create the default structure. Afterwards, go into your workspace and copy the .java files into the src package directory. Then open up the eclipse project or refresh eclipse. Then fix the errors, which are non-declared package statement etc...

If you are just creating a default package directory you don't need to declare package but if you use non-default packages or you have different packages then you need to declare like src is the default package directory and under that if you have say datastructure1 it would be package src.datastructure1;... etc...

The reason why you need to create a project and then copy in the .java files is first you don't have the .classpath or the .project file at the top of the project file directory. If you are just given the .java files and nothing else.
Edited by adramalech707 - 11/8/12 at 11:33am
Intel build
(17 items)
 
  
CPUMotherboardGraphicsRAM
i7 860 gigabyte p55-ud6 gigabyte gv-n560oc-1gi Corsair Vengeance CMZ8GX3M2A1600C9 
Hard DriveHard DriveHard DriveOptical Drive
Crucial M4 WD Caviar Black WD Caviar Black LiteOn Lightscribe 24x 
CoolingOSMonitorMonitor
Thermaltake Frio Extreme CLP0587 Arch Linux x86_64 samsung 2243swx ASUS vs-248H-p 
KeyboardPowerCaseMouse
moditek led flex Seasonic 860Watt Platinum Antec Lanboy air razor death adder 
  hide details  
Reply
Intel build
(17 items)
 
  
CPUMotherboardGraphicsRAM
i7 860 gigabyte p55-ud6 gigabyte gv-n560oc-1gi Corsair Vengeance CMZ8GX3M2A1600C9 
Hard DriveHard DriveHard DriveOptical Drive
Crucial M4 WD Caviar Black WD Caviar Black LiteOn Lightscribe 24x 
CoolingOSMonitorMonitor
Thermaltake Frio Extreme CLP0587 Arch Linux x86_64 samsung 2243swx ASUS vs-248H-p 
KeyboardPowerCaseMouse
moditek led flex Seasonic 860Watt Platinum Antec Lanboy air razor death adder 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Importing external .java files on a java project in eclipse?