Engineeringserver.com

A community for computer science students & developers about software development, game development, game design, games, anime preview & reviews and more!


Java compiler API, compiling made easy

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 3.33 out of 5)
Loading ... Loading ...
1,889 views

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...)


Your Ad Here

Creating a Simple Servlet Using IRAD

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
322 views

This free, multimedia tutorial shows you how to use IBM's Rational Application Developer (IRAD) to create a J2EE project, a Servlet, and a WebSphere Test Server on which you can proudly run your newly birthed Servlet.

If you found something helpful here, please do your part and help support the site. Link to us, buy some books, support our sponsors, tell your developer friends about us, and remember: Happy Java!


(more...)


Your Ad Here

Fonts demo, what your texts looks like

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
881 views
JAVA:
  1. /*--------------------------------------------------------------------------
  2. FontGuiDemo class
  3. *****************
  4. By: HappyFace     http://www.engineeringserver.com - http://www.javaforums.net
  5. Contact:        info [@] engineeringserver.com
  6. Version:        18/August/2008
  7. Last updated:     18/August/2008
  8. *****************
  9. Note: The application will load all fonts available on the system and shows the text in the selected font.
  10. //----------------------------------------------------------------------*/

Download the demo here


Your Ad Here

Java free disk space

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3 out of 5)
Loading ... Loading ...
378 views

A request I got from a member on our forum to write an example to get the total and free diskspace left on the local harddisk. Note: Java SE 1.6 is required to run the sourcecode.

Output:
Java free diskspace demo
c:\ 111,79 Gb total 13,39 Gb left
d:\ 0,00 Gb total 0,00 Gb left
e:\ 0,00 Gb total 0,00 Gb left
f:\ 0,00 Gb total 0,00 Gb left
g:\ 0,00 Gb total 0,00 Gb left
h:\ 0,48 Gb total 0,01 Gb left

(more...)


Your Ad Here

Java 2d Collision detection demo

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
918 views

A demo I wrote to figure out how collision detection works in Java. This demo shows 2 rectangles, one that is controlled by the mouse (white) and one that moves diagonally (green). if the white rectangle hits the green one the "hit" counter will go up by one. In this demo you must try to avoid the green rectangle and hit the upper left and lower right to gain points.

For more info, downloads and the sourcecode visit the topic on our forums here


Your Ad Here

Get CPU and memory usage statistics in Java application

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.5 out of 5)
Loading ... Loading ...
1,033 views

For those that want to know how to see the CPU and memory usage statistics in a Java application here's a demo that P. Lawrey wrote.

Output
getCommittedVirtualMemorySize = 28811264
getFreePhysicalMemorySize = 1207009280
getFreeSwapSpaceSize = 3365294080
getProcessCpuTime = 109375000
getTotalPhysicalMemorySize = 2145497088
getTotalSwapSpaceSize = 4129447936
Calendars are surprisingly expensive. Creating 100000 Calendars
getCommittedVirtualMemorySize = 91783168
getFreePhysicalMemorySize = 1154912256
getFreeSwapSpaceSize = 3302273024
getProcessCpuTime = 671875000
getTotalPhysicalMemorySize = 2145497088
getTotalSwapSpaceSize = 4129447936

(more...)


Your Ad Here

Java paint demo 2

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
616 views

Another vid, no more flickering but there are still some problems with the actual drawing ("gaps" appear when moving the mouse too fast, but i'm working on it)

(more...)


Your Ad Here

Java paint application

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
455 views

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.


Your Ad Here

AdsPanel video, add banners, logo’s and links to any Java Swing application!

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
560 views

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...)


Your Ad Here

Java Video Tutorial 8: Arrays

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
377 views

Woah! I'm back!
I apologize for the long long long (etc etc) delay in this release... I have just been so busy.

But now, I'm back - bigger, better and with cracklier audio for your viewing pleasure!

This tutorial shows you how to use arrays.


Your Ad Here