How can I import lets say the GreenfootSound class into one of my projects in Eclipse? I got the Greenfoot open source files, but I'm not quite sure where to go from here.
class Boot: tools.jar not found. Potential problem for execution. java.lang.Error: Unresolved compilation problems: The import com.apple cannot be resolved The import com.apple cannot be resolved The import com.apple cannot be resolved QuitResponse cannot be resolved to a type Application cannot be resolved to a type Application cannot be resolved com.apple cannot be resolved to a type AppEvent cannot be resolved to a type com.apple cannot be resolved to a type AppEvent cannot be resolved to a type com.apple cannot be resolved to a type AppEvent cannot be resolved to a type QuitResponse cannot be resolved to a type QuitResponse cannot be resolved to a type com.apple cannot be resolved to a type AppEvent cannot be resolved to a type QuitResponse cannot be resolved to a type QuitResponse cannot be resolved to a type QuitResponse cannot be resolved to a type at bluej.Main.<init>(Main.java:32) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at bluej.Boot.bootBluej(Boot.java:323) at bluej.Boot.main(Boot.java:168)
After that I tried to setup the source and output paths:
Lastly I went to the Run Configuration and made the following changes to a new run option I named "BlueJ":
You might have facepalmed a few times looking through the steps I made, but anyway I would like some help with the problem. Thanks in advance! /**
* Get the URL of the current tools.jar file
* Looks for lib/tools.jar in the current javaHome
* and in the parent of it.
* tools.jar is needed on many (but not all!) systems. Currently,
* MacOS is the only system known to us without a tools URL, but
* there may be others in the furure. This method returns null
* if tools.jar does not exist.
*
* @return The URL of the tools.jar file for the current Java implementation, or null.
* @exception MalformedURLException for any problems with the URL
*/
private URL getToolsURL()
throws MalformedURLException
{
String osname = System.getProperty("os.name", "");
if(osname.startsWith("Mac")) // we know it does not exist on a Mac...
return null;
File toolsFile = new File(javaHomeDir, "lib/tools.jar");
if (toolsFile.canRead())
return toolsFile.toURI().toURL();
File parentDir = javaHomeDir.getParentFile();
toolsFile = new File(parentDir, "lib/tools.jar");
if (toolsFile.canRead())
return toolsFile.toURI().toURL();
else {
// on other systems where we don't find it, we just warn. We don't expect it
// to happen, but you never know...
System.err.println("class Boot: tools.jar not found. Potential problem for execution.");
return null;
}
}
Buildfile: D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml
update-images:
[copy] Copying 1 file to D:\home\davmac\workspace\greenfoot\package
[copy] Copying 1 file to D:\home\davmac\workspace\greenfoot\package
[copy] Copying 1 file to D:\home\davmac\workspace\greenfoot\boot\src\bluej
[copy] Copying 1 file to D:\home\davmac\workspace\greenfoot\package\macfiles\Greenfoot.app\Contents\Resources
[copy] Copying 1 file to D:\home\davmac\workspace\greenfoot\package\macfiles\Greenfoot-legacy.app\Contents\Resources
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
[copy] Copying 1 file to D:\Program Files (x86)\eclipse\workspace\greenfoot\images
init:
[copy] Copying 20 files to D:\Program Files (x86)\eclipse\workspace\greenfoot\classes
[copy] Copying 5 files to D:\home\davmac\workspace\greenfoot\lib
[mkdir] Created dir: D:\Program Files (x86)\eclipse\workspace\greenfoot\package
compile:
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:197: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[rmic] RMI Compiling 16 classes to D:\Program Files (x86)\eclipse\workspace\greenfoot\classes
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.PackageAlreadyExistsException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in interface rmiextension.wrappers.RProject.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in rmiextension.wrappers.RProjectImpl.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in rmiextension.wrappers.RProjectImpl.
[rmic] error: Class bluej.extensions.ProjectNotOpenException not found in rmiextension.wrappers.RProjectImpl.
...
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Stub.java:199: Class bluej.extensions.BPackage not found.
[rmic] public bluej.extensions.BPackage getPackage()
[rmic] ^
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Stub.java:205: Class bluej.extensions.BPackage not found.
[rmic] return ((bluej.extensions.BPackage) $result);
[rmic] ^
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Stub.java:209: Class bluej.extensions.BPackage not found.
[rmic] bluej.extensions.BPackage $result;
[rmic] ^
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Stub.java:212: Class bluej.extensions.BPackage not found.
[rmic] $result = (bluej.extensions.BPackage) in.readObject();
[rmic] ^
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Stub.java:220: Variable $result may not have been initialized.
[rmic] return $result;
[rmic] ^
[rmic] D:\Program Files (x86)\eclipse\workspace\greenfoot\classes\rmiextension\wrappers\event\RInvocationEventImpl_Skel.java:111: Class bluej.extensions.BPackage not found.
[rmic] bluej.extensions.BPackage $result = server.getPackage();
...
[rmic] 187 errors
BUILD FAILED
D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:202: Rmic failed; see the compiler error output for details.
Total time: 1 second#####################################################################
## BlueJ build properties
#####################################################################
##
## This file contains user system related properties for building
## bluej via ant. Tis file gets includes into bluej's main build.xml
## via the property ant task. This means build.xml does not need to
## contain machine specific config information.
##
#####################################################################
#####################################################################
# the build_java_home is used to find the compiler to fork and the
# tools.jar file to use with it. Note that in general all
# compilation should be done on the minimum supported JDK for
# BlueJ (which is currently Java 6)
#####################################################################
#build_java_home=c:/Program Files/Java/jdk1.6.0_13
#build_java_home=/opt/jdk1.6.0
#build_java_home=/System/Library/Frameworks/JavaVM.framework/Versions/1.6
build_java_home=/opt/jdk1.7.0_40
# java_command_dir_name should normally be 'bin', except on Mac (Java 6
# and prior) where it should be 'Commands'
java_command_dir_name=bin
#java_command_dir_name=Commands
#####################################################################
# the run_java_home is used to find the jvm to run and the
# corresponding tools.jar file. Usually the same as above.
#####################################################################
run_java_home=${build_java_home}
#####################################################################
# The JDK is bundled with the non-legacy Mac build.
#####################################################################
mac_bundled_jdk_path=/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk
#####################################################################
# Pass this property down to lower build files to find various jars etc
# Makes it easier if the current directory is not bluej_home
#####################################################################
bluej_home=D:\Program Files (x86)\eclipse\workspace\bluej
#bluej_home=/Users/mik/Development/bluej
#####################################################################
# This property defines where the "Wix" bin directory (containing
# the Wix executables) is. Needed for building the .msi Windows
# installer.
#####################################################################
wix_bin=C:/Program Files/Windows Installer XML v3.5/bin
#####################################################################
## Greenfoot build properties
#####################################################################
##
## This file contains user system related properties for building
## greenfoot via ant. Tis file gets includes into greenfoot's main
## build.xml via the property ant task. This means build.xml does not
## need to contain machine specific config information.
##
#####################################################################
# Location of the BlueJ project
#bluej.projectdir=/home/davmac/workspace/greenfoot
bluej.projectdir=D:\Program Files (x86)\eclipse\workspace\bluej
# Location of the Greenfoot project
greenfoot.projectdir=D:\Program Files (x86)\eclipse\workspace\greenfoot
#greenfoot.projectdir=/home/polle/netbeansWorkspace/greenfoot
#####################################################################
# The following is only needed when executing BlueJ from Ant or an
# IDE.
#####################################################################
# tutorial (an URL)
greenfoot.tutorial=file://${greenfoot.projectdir}/resources/tutorial/tutorial.html
# tutorial scenario (a name)
greenfoot.tutorial.scenario=wombats
# location of the scenarios (a File)
greenfoot.scenarios=${greenfoot.projectdir}/scenarios
#####################################################################
# Which scenario to use when running the standalone viewer.
# This is used for profiling.
#####################################################################
greenfoot.standalone.scenario=${greenfoot.scenarios}/greeps/
greenfoot.standalone.main=Earth
greenfoot.standalone.labels=${greenfoot.projectdir}/labels/english/greenfoot-labels
#####################################################################
## BlueJ build properties
#####################################################################
##
## This file contains user system related properties for building
## bluej via ant. Tis file gets includes into bluej's main build.xml
## via the property ant task. This means build.xml does not need to
## contain machine specific config information.
##
#####################################################################
#####################################################################
# the build_java_home is used to find the compiler to fork and the
# tools.jar file to use with it. Note that in general all
# compilation should be done on the minimum supported JDK for
# BlueJ (which is currently Java 6)
#####################################################################
#build_java_home=c:/Program Files/Java/jdk1.6.0_13
#build_java_home=/opt/jdk1.6.0
#build_java_home=/System/Library/Frameworks/JavaVM.framework/Versions/1.6
build_java_home=D:/Program Files/Java/jdk1.7.0_40
# java_command_dir_name should normally be 'bin', except on Mac (Java 6
# and prior) where it should be 'Commands'
java_command_dir_name=bin
#java_command_dir_name=Commands
#####################################################################
# the run_java_home is used to find the jvm to run and the
# corresponding tools.jar file. Usually the same as above.
#####################################################################
run_java_home=${build_java_home}
#####################################################################
# The JDK is bundled with the non-legacy Mac build.
#####################################################################
mac_bundled_jdk_path=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk
#####################################################################
# Pass this property down to lower build files to find various jars etc
# Makes it easier if the current directory is not bluej_home
#####################################################################
bluej_home=D:/Program Files (x86)/eclipse/workspace/bluej
#bluej_home=/Users/mik/Development/bluej
#####################################################################
# This property defines where the "Wix" bin directory (containing
# the Wix executables) is. Needed for building the .msi Windows
# installer.
#####################################################################
wix_bin=C:/Program Files (x86)/WiX Toolset v3.8/bin
#####################################################################
## Greenfoot build properties
#####################################################################
##
## This file contains user system related properties for building
## greenfoot via ant. Tis file gets includes into greenfoot's main
## build.xml via the property ant task. This means build.xml does not
## need to contain machine specific config information.
##
#####################################################################
# Location of the BlueJ project
#bluej.projectdir=/home/davmac/workspace/greenfoot
bluej.projectdir=D:/Program Files (x86)/eclipse/workspace/bluej
# Location of the Greenfoot project
greenfoot.projectdir=D:/Program Files (x86)/eclipse/workspace/greenfoot
#greenfoot.projectdir=/home/polle/netbeansWorkspace/greenfoot
#####################################################################
# The following is only needed when executing BlueJ from Ant or an
# IDE.
#####################################################################
# tutorial (an URL)
greenfoot.tutorial=file://${greenfoot.projectdir}/resources/tutorial/tutorial.html
# tutorial scenario (a name)
greenfoot.tutorial.scenario=wombats
# location of the scenarios (a File)
greenfoot.scenarios=${greenfoot.projectdir}/scenarios
#####################################################################
# Which scenario to use when running the standalone viewer.
# This is used for profiling.
#####################################################################
greenfoot.standalone.scenario=${greenfoot.scenarios}/greeps/
greenfoot.standalone.main=Earth
greenfoot.standalone.labels=${greenfoot.projectdir}/labels/english/greenfoot-labels
compile:
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:197: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable buildscompile-scenarios:
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:240: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:240: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:240: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:240: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds[javadoc] D:\Program Files (x86)\eclipse\workspace\greenfoot\common\GifImage.java:43: warning - @overrides is an unknown tag.
compile-standalone:
[delete] Deleting directory D:\Program Files (x86)\eclipse\workspace\bluej\lib\greenfoot\standalone
[mkdir] Created dir: D:\Program Files (x86)\eclipse\workspace\bluej\lib\greenfoot\standalone
[javac] D:\Program Files (x86)\eclipse\workspace\greenfoot\build.xml:599: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 115 source files to D:\Program Files (x86)\eclipse\workspace\bluej\lib\greenfoot\standalone
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] 1 warning[javadoc] D:\Program Files (x86)\eclipse\workspace\greenfoot\src\greenfoot\Actor.java:586: warning - @return tag has no arguments.