When is it soon enough to use new Java features? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm developing an application that I plan to publicly release, or at least share with a group of people. The problem that I am facing as a developer is compatibility. On my machine, I am using the new Java 8, but I am afraid to use its new features, and in fact, I'm even afraid to use the new features in Java 7, like try-with-resources, in fear that the users will not have an up-to-date Java version, and consequently, will not be able to use my application. For example, my school's computers still use Java 6.
First off, am I correct in thinking that? Or can code compiled with a newer JDK run on a machine with an older JRE? If I am correct, is there an established "rule" or standard for compatibility? Something like, "Make sure your code is compatible with a JRE that is two versions old!" Or is it purely a matter of the developer's judgement of when new features should be utilized for a released work? And just for emphasis, I am talking about just running the program. The user will never have to compile it.
I know this is a bit open ended, but this is the best place that I could think of to ask.
Thanks.

First, you can always specify the version of Java that you want to support by compiling it with the -version flag. This means, since you're using Java 8, you could always force your code to compile down to a lower version (that is, Java 6).
To your point about older Java versions - yes, you'll likely run into that. A lot of people don't update their Java version for one reason or another. But, this is where you have to make a decision: do you choose to support their version, or do you choose to support another version? This particular part is open-ended, but depending on what you ultimately want to use in your code (diamond operator, try-with-resources (which is actually very nice), NIO), then you'd want to use the version of Java that works well with you and with what you want to support.

Related

How to implement parallel processing using CUDA in Java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have installed CUDA toolkit and download some libraries and exported to my Java project in Netbeans. I never using CUDA before and I am very interesting to learn for my parallel algorithm. My question is:
How I know that my environment is ready to use CUDA? Is there any code to check it in Java?
I need a best practice to implement parallel processing using CUDA in Java? Is there anybody that has simple parallel code that I can use to learn CUDA?
If this is your first time using Cuda, I would highly recommend using the language it was designed for (C/C++). Cuda is only available through java through bindings like JCuda. Using these bindings reduces your example code sample size and support pool, along with adding yet another thing that can go wrong. More complexity, more problems.
If you do insist on using JCuda, here are their official sample projects.
As for testing if your "environment" is ready to use cuda, you can check your cuda version in a command prompt with nvcc -V. If the command is unrecognized, something is wrong.
You can use nvcc to compile the sample projects that should have come with your cuda installation. I believe by default on windows they are located in C:\ProgramData\NVIDIA Corporation\CUDA Samples\.

Why is it recommended to change the jdk after long use? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
When I was first learning java from a crash course, we were advised by the teacher to change the jdk after long use.
While she couldn't provide any scientific explanation to this, even I find it necessary to change the jdk at points of time. In the computer at my home, sometimes it happens that a program that I've written, is syntactically, semantically and logically correct, but both BlueJ and NetBeans give unexplained compilation or run-time error. Both BlueJ and NetBeans run on the same jdk.
If I download a new jdk package and install it, removing the previous one, it solves the problem.
Can anyone explain this?
New versions of the JDK can run old code, but the opposite is not necessarily true: Recent applications will take advantage of recent features of the JDK, and will not be compatible with older versions.
Note that sometimes, applications built with some JDK may not run with newer versions. For instance, JDK 7 has removed some deprecated classes from JDK1.6.

Is it possible to disable modules in Java 9? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I use OSGI and this is the main reason that I want to disable modules, as I really don't need another module framework. Is it possible to do it, for example using command line option? If yes, then how?
There is no option to turn off the module system - it will always be active. This impacts access to JDK-internal APIs, dependencies on Java EE modules, Split packages, and a lot of other small details. Your code and your dependencies have to deal with those migration challenges if you want your application to run on Java 9.
You are by no means forced to create modules, though. You can completely ignore module-info.java and continue to place all your JARs onto the class path. The module system will silently bundle them all into the unnamed module, which was created for maximum compatibility. You won't even notice the module system is there (assuming you've overcome the challenges I described earlier).
Yes surely you can as the interviewee said here
Trisha Gee: Many people don’t realize you can use Java 9 and all its shiny new features WITHOUT using Jigsaw, i.e. you can use Java 9 very happily without migrating any of your code. There are some things which have changed in Java 9 (e.g. hiding away internal APIs) but theoretically, if your application was doing all the right things to begin with, there should be no problem compiling and running with Java 9.
have a look for the entire interview but As you saw we will have two types for Java Applications one for modular world and another for non-module system that's why Red Hat and IBM voted no for JSR 376 as mentioned here but they vote okay after that!
for more about Java 9 Module System with OSGI have a look here
Hope this is useful

Making MATLAB Code Platform Independent [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a MATLAB code (including Simulink models) which I would like to make platform-independent, i.e., allowing them to run on web browsers and smartphone apps. Would coding it in Java be the best solution? And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again? Thanks for your suggestions!
Short answer: You'll have to recode
Would coding it in Java be the best solution?
Probably not. I've found that java is hardly ever the best solution. It may be the easiest, but I doubt it's the best. But for web-browsers, AFAIK, you must render some part down to javascript (even if it's just a shim to fetch data running on a server), flash, silverlight*, or java*. For iphone, you need to do it in C, Objective-C, or C++. I think Android uses some kind of java-like/based language, but I don't know. I doubt Win Mobile 8 even has a JVM, but don't really know there.
* Few people like to leave these plugins open. Too easy to exploit and few sites use them.
And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again?
Mathworks makes an m-code compiler, but you still need a lot of their libraries. It compiles for x86 under Windows and Linux. I think it supports a few other OS's, but all x86 unless they changed it around again. I guess you could try to get MCR working on a phone, but not in a web browser. Realtime Workshop renders simulink models to C, but not if they contain matlab function blocks (or some other blocks, I forget the full list). I hope you have a crap ton of cash, 'cause both those are expensive toolsets.

Applications to use Java with [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I recently downloaded Java JDK, and installed it on my PC, yet I only received Java Mission Control, which is useless to me. Is there another way of getting programs to create apps in Java with?
Thanks :)
Personally I have used 3 different IDEs them being:
IntelliJ
Netbeans
Eclipse
I personally, as being the first IDE that I used was Eclipse, but Netbeans is taking a great liking on me because of its ability to use multiple different languages in an easy to use interface. Although Eclipse being the greatest in my opinion because of its easy keybindings and a ton of useful plugins. IntelliJ is the least favourite of the 3 because I find it cumbersome, but that is just my opinion.
I would do a quick google search for "Eclipse IDE", it makes the process of developing a program much easier in my opinion. It may seem intimidating at first but just look up a few tutorials and you should be okay.
find for
`
eclips
netbeans
IDE but these IDE are for professionals who are hands on java
after some set of practice's use one of above IDE
if you want to remember and learn the concept of .class files, packages and command line then go with
Notepad
Notepad++
Editplus

Categories