This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

WeiJie Lim

Ranch Hand
+ Follow
since Sep 05, 2012
Under your bed.
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by WeiJie Lim

How does the keyword this in the CoffeeSize class refer to the size of the coffee ? I am also confused as to how the CoffeeSize constructor comes into play to determine the cost.


3 years ago
Thanks for the tip, Paul Clapham. I didn't realise that FileWriter does create an empty file if it is not existent.
3 years ago
My code below creates the 2 files successfully, but it is not able to write the sample data into the newly created file. I can't figure out the reason why.

Another strange thing is that when I tried inserting System.out.println calls for debugging, nothing prints out.

Any guidance is appreciated.

3 years ago
I am trying to split the contents of the text file and assign the value on the left of the | separator to a variable and the value on the right of the | separator to another variable. Thus I tried out a sample code to print all the values in the split [] first, and ended up with problems.

This is the content of the text file:
Crazed Boy|20

I keep getting IOException in my sample code, why is this so ? I assumed the split() method is supposed to output for the 1st iteration:
ss[0] = Crazed Boy
ss[1] = 20

Guess I am wrong in my understanding.
3 years ago

Matthew Brown wrote:

Not if you call super(...) or this(...) explicitly yourself. But otherwise, yes.

Oh yeah, thanks for the clarification
3 years ago
Thanks @Matthew Brown and @K. Tsang for your clear replies.

Am I right to say that there is always a 'hidden' super(); in each subclass constructor ?
3 years ago
The LocalStudent class inherits the Student class. The IDE states an error of "no default constructor in Student class". Why is this so ?

I understand that if a LocalStudent object is created, the default constructor of its superclass (aka Student class) will be called implicitly.

But in this case, there is no LocalStudent object being created, so why is the default constructor of Student being called ?

The default constructor of LocalStudent is also overloaded by the created no-arg constructor containining subjects = null; . So there is no call to the superclass default constructor from the default constructor of LocalStudent.

3 years ago
Okay noted, will do so in the future

I managed to solve it, it was due to the messy permissions I have set for the apache folders.

I used a fresh apache folder unzipped from the tar.gz downloaded from Apache's website and everything is back to normal.

Cheers ~
4 years ago
This is my apache tomcat logs -

I can load index.html when I enter localhost:8080/dsm/index.html , but once I changed it to a jsp file, a blank page occurs.

Could it be due to the scratchDir error in the logs ?
4 years ago

E Armitage wrote:The ternary operator is a short hand for if-else based assignment. If the array or arguments args has values then the first argument is assigned as the host, otherwise "localhost" is used as the as host. So if you call the program and provide an argument for the host then that argument value is used, if you call without any arguments then "localhost" is used.

Thanks for the explanation
I see this similar line of code often in a Java book that I am reading.

Why does it have to set it to args[0] if the argument length is >0 ?

In my JSP file, the getProperty values is NULL. I am trying to troubleshoot this issue.

JavaBean file (GetData).

Javabean Database

In this, there are multiple movieNames and so forth being set to the respective Javabean. Could this be the issue ?

4 years ago

Eclipse highlighted the portion in red with the error. I seriously can't find what is the issue with the double quotes. Any help is appreciated .
4 years ago

Saif Asif wrote:
You should make sure that the environment is setup properly.

Now there is always this error, " could not find any files matching glob".

I tried changing the command line from the default "-f -n 100 jbossas-7/logs/*" to "-f jbossas-7/logs/server.log -o '-n100' " and it still gives the same " could not find any files matching glob" error.

Saif Asif wrote:
No , once jboss7 deploys a war file e.g named ( test.war) , a file named test.war.deployed will be created which shows successful deployment of the app. If its not being created then there is something wrong with the deployment.

Hmm is there any reason why the .deployed file isn't created ? Any guidance is appreciated. I followed this linkto setup my Openshift app on Eclipse.

4 years ago

Saif Asif wrote:Hello Lim,

Did you see the logs of JBOSS when you performed any of the 4 steps ? Was the war file successfully deployed at all in the first place ?

I can't seem to view the log files under Openshift > Tail Files. It keeps showing "loading..." and nothing happens.

Attached is the image below after I copied the WAR file into the deployments folder and published it. Is the WAR file supposed to still remain as a WAR file ?

4 years ago