i am looking into making my own OS just to say i've done it. i know that there is a project called JNode that has done one in assembly and java.
what i was wondering was, what embedded graphics do you need to run java? i know java uses the graphics of the specific os so this confuses me
I think you would need to port the JVM to your OS. Have a look at the Java Virtual Machine spec. It will tell you exactly what need to implement to support Java.
If you need to implement AWT/Swing, then you obviously need to have some kind of library that can draw 2D graphics in a screen. I'd recommend however to start from implementing the virtual machine and some basic libraries. Printing in a screen will be sufficient.
Have a look here for a list of implementations of JAVA for the ARM platform. Kaffe is interesting.
Java can run in headless mode. That might be a good starting point suitable for server side stuff, which you can then extend if you feel like it.
Have a look at Sanos - http://www.jbox.dk/sanos/ - which is a tiny OS providing just the facilities needed to run the Windows JVM.
Related
I am currently in high school. I was recently browsing the internet looking for what employees in the software industry usually want and what the job requirements are like.
I came accros a job description and one of the requirement is:
Strong, object-oriented design and coding skills (C/C++ and/or Java
preferably on a UNIX or Linux platform)
Note the last part: Java preferably on a UNIX or Linux platform.
I don't understand this. Isn't Java run inside a virtual environment/machine? Why would it matter what OS it is running on since Java cannot directly interact with the OS?
A developer job description may require experience with some OS for several reasons:
First, as you noticed already, there are languages that talk directly to the OS and the code needs to be aware of the underlying OS (like C/C++, which are listed in your job description).
Secondly, even if the programming language abstracts away anything that's OS-specific from you (including the file-system / path separators), you are still going to deploy / configure / run / monitor your applications on top of some OS and you need to know (at least) the basics in order to do that.
For a Java job description, If UNIX/Linux "is a plus", it usually means you're going to run your code on a UNIX/Linux system and you should know how to start a process (your own java app or some application server), how to deploy an application in a container, how to read log files and so on...
While Java the language runs on a virtual machine, the Java library must abstract access to facilities available on the host platform. Ideally, these abstractions are cross-platform, but the devil is in the details—hence the preference for experience on a particular target platform.
Develop once debug everywhere
While conceptually it shouldn't make any difference on what target platform the java code is executed on unfortunately in practice it isn't always that simple but a rather tedious task to get the code running on any platform.
Beginning from easy to circumvent mistakes e.g. using / or \ instead of java.io.File.separatorChar or : / ; instead of or java.io.File.pathSeparatorChar
there are most often problems including methods implemented in native code that often aren't that compatible across different platforms.
It might be even possible your employer is looking for someone to implement native java methods using JNI.
First, you're right in that Java runs inside of a virtual machine - it doesn't directly expose the inner workings of the system to you. However, that doesn't mean that each system doesn't differ in some way under the covers - different flavors of operating systems have different kernels, different ways they think about scheduling, different ways to handle threading, and different interrupt chains (Linux has quite a few signals, whereas Windows has a handful).
As far as Java (the language) is concerned, it runs the same everywhere. How it's actually accomplished is dependent on the native JVM that it's running on.
For this job posting, though, I wouldn't read too much into the UNIX/Linux portion. This is more or less gauging how comfortable someone would be working in a UNIX or Linux environment while programming Java. The majority of IDEs available for Java are cross-platform, but that shop may be using Mac or some flavor of *nix (RHEL, Debian, Ubuntu, etc). It'd also be important to make use of the command line/shell script, since a lot of the convenience of working with UNIX/Linux is on the command line.
Not every shop uses Windows machines to develop on. Just a heads-up.
Java does not differ on different platforms. That is the most highlighting feature of Java ( portability ). The JVM abstracts the underlying platform.
However, platform matters when it comes to a software development, which involves not just the coding part. Mostly in industries, devs work on Linux platform by logging into a terminal. You don't get a GUI as in Windows and a good IDE like NetBeans. So in that case, you should know how to compile and run a java program from terminal.
Example, In linux, In order to create a package, you create a directory ( folder ), say myJava/. You go into it (cd myJava) and write the SomeThing.java file and compile using javac SomeThing.java and you get a SomeThing.class file ( inside myJava ). Now in order to execute this, you need to use the java command. Prior using it, you need to move to the parent directory containing this package. Then execute as java myJava.SomeThing. You wouldn't be knowing this unless you play around in Linux platform. Other things like setting up the classpath etc are also matters of concern
I have a java application that was mainly built for the Mac. I need to be able to do either one of three things:
Have my application always follow the current space. Meaning, if I'm on Desktop 2 and start my app, then I switch to Desktop 3, my app will then be visible on Desktop 3 automatically. This is equivalent to right-clicking on the app icon in the dock, select Options, then choose All Desktops. If I can somehow make this the default behavior for my app, without requiring user action, then that would be great!
Capture the screen of a specific space. I currently use the Robot class to take a screen capture. If there is a way I can specify which space to capture, not just the current space, then that would be great!
Be able to at least detect if leaving the current space.
I'm starting to lean towards neither one of these are possible. But if you can give any help, or possible workarounds, that would be awesome!
I have also played around with the GraphicsEnvironment, GraphicsDevice, GraphicsConfiguration, but no luck. It doesn't return any info about Mac's Virtual Desktops (Spaces).
What is also making things difficult is I'm trying to avoid using platform specific code at all costs! I know I can use JNI to accomplish this, or there may be something in the java-apple extension. But currently, I use a single code branch and build for both Mac & Windows. I'm trying to avoid having two separate builds and binaries for both platforms.
The answer is "no" unless you are writing native code and using JNI. One of the key design features of Java is that it is OS agnostic. What you are asking for is extremely Mac OS X specific. I see nothing in the Apple Java Extensions that helps either.
No, as far as I know, Java doesn't have any special support for Spaces, so you'll need to use platform-specific, native code. However, JNI--with all its ugliness--isn't your only option. You can use JNA instead, which is much more programmer-friendly, and a lot easier to debug.
In your app, you can detect the platform. If it's a platform for which you've written platform-specific code, you can execute that code. If not, you can fall back to a default, pure Java implementation.
I'm looking for Java bindings for XLib.
Specially, I need to be able to reparent an X windows application from within Java.
Ideally I would like to do this by making the X windows calls directly from java.
I don't know anything about XLib... but recently I ran across JNA and it seems that it can talk with system APIs so give it a look if you wish:
http://java-native-access.github.io/jna/4.4.0/javadoc/
Good Luck!
I've created xcb (successor of xlib) bindings for Java through SWiG. You can find the code here:
https://github.com/Zubnix/xcb4j
It's a rather large but straightforward implementation and should work once you have all the required xcb module headers installed.
As we know AWT classes uses native OS libraries for creating GUIs but Swing uses Java library itself for creating the GUI.Can anyone please give me an example of the Windows OS library corresponds to a AWT GUI ?
Thx
In theory it may depend on jvm implementation. But in windows it use WinAPI probably.
The short answer is the MFC (Microsoft Foundation Classes) which all of Windows widgets are based on.
If you recall the great MS and Java Lawsuit the reason MS "Split" with how Java was developing was the MFC--at that point, Sun was considering a "JFC" which more or less later became Swing. they didn't want to re-invent something they already have. regardless, Swing is based on AWT which is heavily based on Motif/X which if I remember right is also what MS based their MFC on... It not the jvm that determines how a particular Java Swing/AWT element--like a button, but the Native Peer for that platform, which is bound to Java via the JNI....
If you need to know the really small details of how it's implemented in a low-level, download the jdk source (OpenJDK is FLOSS), and read the code yourself.
Don't expect anyone except developers who were directly related to that code to know the exact answer to your question.
Have you ever attempted using Swing only to end up changing courses because it just couldn't do what you wanted?
I'm pretty new to Swing, having only used it for school projects over 5 years ago, but it seems Swing has come a long way in providing a more native look and feel, so much so that I'm considering using it to develop the GUI for an app on Mac OS X. Before I do, though, I wanted to see if anyone has run into any showstopper issues that prevented them from using Swing.
Just off the top of my head, some possibilities:
Problems developing custom components that looked "right"
Bad interactions with native applications and widgets
Performance issues (unresponsiveness, repaint problems)
Inability to mimic native behaviors (like Dock interaction)
Swing isn't going to give you perfect fidelity with the hosting OS. Sun simply can't devote the considerable resources necessary to do so. My impression is that Swing has gotten much better, but is still going to look out of place by default.
The minimum required to even hope to pass as a Mac app:
package your .jar in a .app
set the L&F to system default
set apple.laf.useScreenMenuBar property to true
must do this before any UI code
Dock interaction is non-existent in standard Java. You'll have to use Apple's Cocoa-Java bridge, which is no longer supported. I have no idea how tractable JNI is on OS X, which is the only real alternative.
Performance shouldn't be a problem. Drag & Drop is probably as hairy on OS X as it is everywhere else.
Basically, if you're explicitly targeting OS X you're best off using Objective-C. Its far from impossible to build an app on OS X using Java & Swing, but its a lot of work to make it look "native".
As Kevin and John said you should try Objective-C, Cocoa and XCode if you are only targeting Mac users. The developer tools for Mac is freely available.
If you want to (or have to) use Java and Swing you can use some libraries to create a GUI that looks well on Macs:
Quaqua look and feel
MacWidgets
For deploying your application you should read the JarBundler docs.
However, in this case interaction with dock and native applications is very limited.
Some other good links are:
Making Java/Swing Applications Look (More) Like
Native Mac OS X Applications
Java: How to handle drop events to the Mac OS X Dock icon
#Kevin++
Using Cocoa is probably better
If you want it to look exactly like native applications
If you are targeting only the Mac
If you intend to distribute your applications for Windows, Linux, etc. Swing is a decent choice. It's better but like in any toolkit there are still issues. You'll never get a truly native look and feel with it, same goes for similar UI toolkits which claim to be "cross-platform".
The Apple Guidelines for Java development can be found here.
Swing is a nice way to go, or you can go SWT, or BOTH!
But either way, use them on top of the RCP platform. (either with Eclipse or Netbeans).
Have a look at this: http://www.adam-bien.com/roller/abien/entry/eclipse_rcp_vs_netbeans_rcp
marco