UPDATE (April 4, 2010) - It's working perfectly now :)
http://zenit.senecac.on.ca/wiki/index.php/Installing_Eclipse_on_Fedora
I am still new to Linux and Eclipse and I'm trying to install Eclipse on Fedora. I have downloaded and installed Eclipse and the JRE but I have error message
JVM terminated. Exit code=-1
I found possible solution at http://forums.fedoraforum.org/showthread.php?p=1318033
which suggested to run ./eclipse -vm /path/to/my/jre
but I don't really understand this, particularily how to find the path to the jre
My entire error message is posted here...
http://pastebin.ca/1827863
Sunday, March 7, 2010
Eclipse for Java and C/C++
I was recently talking with a fellow student about what is a good "All in one" application for developing Java and C/C++ programs in Linux. In the past I have used Xcode and Eclipse on Mac, and Visual Studio on Windows XP/7. I have started to really enjoy using Eclipse for learning Java, so I thought to try it with C++.
I became confused when I went to the Eclipse Downloads page because it looks like there are different versions of Eclipse for different languages. Which one do I choose if I want to use Eclipse for Java AND C/C++ ?
The answer is that you install one, and then you can install other languages as plug-ins.
Initially, it does not matter which version you download first (In my case, I had already installed the java IDE). Once you download it you install and open the program. Then you go to...
Help > Install New Software...
at the "Work with:" field select (using drop arrow on right) --All Available Sites--
This will reveal a list of install options organized in groups. In my case (since I had Java IDE installed already) I chose Programming Languages > Eclipse C/C++ Development Tools.
It's sort of like an Eclipse "Apps Store".
There is an option to "Hide items you have already installed".
Once I went through this process, I restarted Eclipse and went to File > New Project. C/C++ was now available as an option. I opted to create a C project and successfully compiled/ran "Hello World!" inside eclipse.
I did all the steps above using Eclipse on a Mac. I will be blogging about Eclipse on Linux once I get it to work.
Special thanks to bluefire @ freenode.net #eclipse for help figuring this out.
I became confused when I went to the Eclipse Downloads page because it looks like there are different versions of Eclipse for different languages. Which one do I choose if I want to use Eclipse for Java AND C/C++ ?
The answer is that you install one, and then you can install other languages as plug-ins.
Initially, it does not matter which version you download first (In my case, I had already installed the java IDE). Once you download it you install and open the program. Then you go to...
Help > Install New Software...
at the "Work with:" field select (using drop arrow on right) --All Available Sites--
This will reveal a list of install options organized in groups. In my case (since I had Java IDE installed already) I chose Programming Languages > Eclipse C/C++ Development Tools.
It's sort of like an Eclipse "Apps Store".
There is an option to "Hide items you have already installed".
Once I went through this process, I restarted Eclipse and went to File > New Project. C/C++ was now available as an option. I opted to create a C project and successfully compiled/ran "Hello World!" inside eclipse.
I did all the steps above using Eclipse on a Mac. I will be blogging about Eclipse on Linux once I get it to work.
Special thanks to bluefire @ freenode.net #eclipse for help figuring this out.
Sunday, January 31, 2010
Practice 1 - failed tests pt1
The following is a temporary list of my failed tests, along with an explanation.
- test11() -> If ticket price is 200 cents and total deposit is $6.00 then there should be 3 tickets, not 6.
- test12() -> How can the change be 2 when returnChange() was already called? The change has already been returned which resets the data inside the Ticket class. Quote "The returnChange( ) method causes the object to return a change to the customer."
- test13() -> Same reason as test12()
- test14() -> Same reason as test12() -> am I crazy? When I read the specs, it clearly says "The issueTickets() method returns the change to the customer..." which to me, sounds like the change should be returned. Why then would the test check if there is change waiting to be returned if it's already been returned???
What am I missing here?!?!?!
- test11() -> If ticket price is 200 cents and total deposit is $6.00 then there should be 3 tickets, not 6.
- test12() -> How can the change be 2 when returnChange() was already called? The change has already been returned which resets the data inside the Ticket class. Quote "The returnChange( ) method causes the object to return a change to the customer."
- test13() -> Same reason as test12()
- test14() -> Same reason as test12() -> am I crazy? When I read the specs, it clearly says "The issueTickets() method returns the change to the customer..." which to me, sounds like the change should be returned. Why then would the test check if there is change waiting to be returned if it's already been returned???
What am I missing here?!?!?!
Saturday, January 30, 2010
Java Makefile
If you are interested in compiling your java code on a mac, or a unix/linux machine with the terminal, then using a Makefile may be helpful.
I found an easy to use Makefile here...
http://www.cs.swarthmore.edu/~newhall/unixhelp/javamakefiles.html
Remember that the indented lines must be TAB. If you copy/paste this code, the TAB's may become SPACES which would not work.
I am running mac OS 10.6.2 and using xcode to write my java programs. I compile and run them inside the mac terminal.
Here's my Makefile for JAC444 practice 1.
#
# define compiler and compiler flag variables
#
JFLAGS = -g
JC = javac
#
# Clear any default targets for building .class files from .java files; we
# will provide our own target entry to do this in this makefile.
# make has a set of default targets for different suffixes (like .c.o)
# Currently, clearing the default for .java.class is not necessary since
# make does not have a definition for this target, but later versions of
# make may, so it doesn't hurt to make sure that we clear any default
# definitions for these
#
.SUFFIXES: .java .class
#
# Here is our target entry for creating .class files from .java files
# This is a target entry that uses the suffix rule syntax:
# DSTS:
# rule
# 'TS' is the suffix of the target file, 'DS' is the suffix of the dependency
# file, and 'rule' is the rule for building a target
# '$*' is a built-in macro that gets the basename of the current target
# Remember that there must be a <> before the command line ('rule')
#
.java.class:
$(JC) $(JFLAGS) $*.java
#
# CLASSES is a macro consisting of 4 words (one for each java source file)
#
CLASSES = \
Student.java \
TestAStudent.java \
Ticket.java \
TestATicket.java
#
# the default make target entry
#
default: classes
#
# This target entry uses Suffix Replacement within a macro:
# $(name:string1=string2)
# In the words in the macro named 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .java of all words in the macro CLASSES
# with the .class suffix
#
classes: $(CLASSES:.java=.class)
#
# RM is a predefined macro in make (RM = rm -f)
#
clean:
$(RM) *.class
I found an easy to use Makefile here...
http://www.cs.swarthmore.edu/~newhall/unixhelp/javamakefiles.html
Remember that the indented lines must be TAB. If you copy/paste this code, the TAB's may become SPACES which would not work.
I am running mac OS 10.6.2 and using xcode to write my java programs. I compile and run them inside the mac terminal.
Here's my Makefile for JAC444 practice 1.
#
# define compiler and compiler flag variables
#
JFLAGS = -g
JC = javac
#
# Clear any default targets for building .class files from .java files; we
# will provide our own target entry to do this in this makefile.
# make has a set of default targets for different suffixes (like .c.o)
# Currently, clearing the default for .java.class is not necessary since
# make does not have a definition for this target, but later versions of
# make may, so it doesn't hurt to make sure that we clear any default
# definitions for these
#
.SUFFIXES: .java .class
#
# Here is our target entry for creating .class files from .java files
# This is a target entry that uses the suffix rule syntax:
# DSTS:
# rule
# 'TS' is the suffix of the target file, 'DS' is the suffix of the dependency
# file, and 'rule' is the rule for building a target
# '$*' is a built-in macro that gets the basename of the current target
# Remember that there must be a <> before the command line ('rule')
#
.java.class:
$(JC) $(JFLAGS) $*.java
#
# CLASSES is a macro consisting of 4 words (one for each java source file)
#
CLASSES = \
Student.java \
TestAStudent.java \
Ticket.java \
TestATicket.java
#
# the default make target entry
#
default: classes
#
# This target entry uses Suffix Replacement within a macro:
# $(name:string1=string2)
# In the words in the macro named 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .java of all words in the macro CLASSES
# with the .class suffix
#
classes: $(CLASSES:.java=.class)
#
# RM is a predefined macro in make (RM = rm -f)
#
clean:
$(RM) *.class
Saturday, January 23, 2010
Java Default Constructor Question
In class today it occurred to me that since Java will always set new variables to a default empty (NULL) state, then there may be no need to have a default constructor unless you want the default to be some value other than NULL.
If a programmer only needs default settings, then is it possible to avoid writing the default constructor all together, even if you have other constructors that receive arguments?
Subscribe to:
Posts (Atom)
