17 Sep 2008 @ 11:59 PM 

I’ve been working on my Java online compiler earlier today and while the software is far from finished it does work as intended (it tries to compiles the java file and will show the appropiate message(s)) . One of the thing that does’t work however is that when the file is compiled succesfully the generated class file wil not run for some reason but it does work when i test my compiler class seperately in another project with Eclipse. Wierd? It sure is, but maybe there is a nasty bugger somewhere in the code that i’ve overlooked. Stay tuned!

Want to take a look at the code? Go to our svn server -> project -> OnlineCompiler

Here’s an example output when a user uploads a *.java file to the webserver or local directory where the folder watcher is running.
More »

Tags Tags: , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 05 Oct 2008 @ 06 28 PM

E-mailPermalinkComments (1)
 21 Aug 2008 @ 12:09 AM 

Before Java 1.6 was released to the public I used the Runtime class (found in java.lang) to call the java compiler (javac.exe) directly to compile a Java file from another Java application, the line of code that i used looks like this

JAVA:
  1. Runtime.getRuntime().exec("C:\\WINDOWS\\system32\\cmd.exe /c start javac " +  userDir + "\\test\\"+className + ".java");

But luckily for me Java 1.6 introduced a handy utility that makes it possible to compile a Java application within a Java application without making direct calls to an external application. To demonstrate that I wrote a HelloWorld Java file and a CompilerConsoleDemo class that compiles the HelloWorld java file.

JAVA:
  1. public class HelloWorld {
  2. public static void main(String[] args){
  3. System.out.println("Hello World");
  4. }
  5. }

More »

Tags Tags: , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 21 Nov 2008 @ 12 23 AM

E-mailPermalinkComments (1)
 08 Aug 2008 @ 12:47 AM 

Remember this post of mine ?

Well, I was bored and updated it a bit so that it now supports different colors, clear drawing screen etc The flickering is because i'm drawing everyline realtime in the background, this will be fixed in a later release.

The sourcecode will be uploaded on the forums shortly.

Tags Tags: ,
Categories: Java
Posted By: HappyFace
Last Edit: 21 Nov 2008 @ 12 24 AM

E-mailPermalinkComments (0)

A Java component I made that you can use to add banners, logo's, animated gifs, links etc to any Java Swing application. I hope you like my Java component! It's free and the old version can be download here on the blog! (I'll upload the latest version later when I have the time)

Oh yeah, the quality of the video is below average (you can't see what i type) but I blame windows movie maker (and youtube for lowering the quality but atleast they are hosting my video)!

//edit
Higher quality video can be downloaded here: http://www.megaupload.com/nl/?d=FSAO2SF5

The code that I used in my demo video

More »

Tags Tags: ,
Categories: Java
Posted By: HappyFace
Last Edit: 21 Nov 2008 @ 12 24 AM

E-mailPermalinkComments (2)
 17 Nov 2008 @ 2:18 AM 

This example shows you how to call a method from another class.
Class #1

JAVA:
  1. package basic;
  2.  
  3. public class MethodCallingA {
  4.  
  5. public static void main(String[] args){
  6. MethodCallingB MCB = new MethodCallingB();
  7. MCB.methodB();
  8. }
  9.  
  10. }

Class #2

JAVA:
  1. package basic;
  2.  
  3. public class MethodCallingB {
  4.  
  5. public void methodB(){
  6. System.out.println("You called the method: methodB");
  7. }
  8.  
  9. }

After you run class #1 the output will be:
You called the method: methodB

Tags Tags:
Categories: Java
Posted By: HappyFace
Last Edit: 17 Nov 2008 @ 07 26 PM

E-mailPermalinkComments (0)
 17 Nov 2008 @ 2:14 AM 

An example how to parse a String to an int

JAVA:
  1. package basic;
  2.  
  3. public class StringToInt {
  4. public static void main(String[] args){
  5. String numberStrOne = "135";
  6. String numberStrTwo = "246";
  7. int result = Integer.parseInt(numberStrOne)Integer.parseInt(numberStrTwo);
  8. System.out.println("The result is " + result);
  9. }
  10. }

The output will be:
The result is 381

Tags Tags:
Categories: Java
Posted By: HappyFace
Last Edit: 17 Nov 2008 @ 02 21 AM

E-mailPermalinkComments (1)
\/ More Options ...
Change Theme...
  • Role »
  • Posts »
  • Comments »
Change Theme...
  • VoidVoid (Default)
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLightweight