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 6 years ago.
Improve this question
I have a Windows service written by another developer who no longer works with me. It was written in C# with .NET 4.5 requirements. Our solution is making the move to Linux and the daemon naturally needs to be converted.
My dilemma is what to rewrite it in? C++ or Java? The daemon is not complicated. It's simply a controller for our other applications to ensure if they crash or are killed they are restarted. Aside from that it performs health checks through a named pipe and is controlled via a password protected web socket via a separate management Tomcat web interface and writes all of it to logs.
Please put aside any suggestions of "write in what you're most comfortable with" I have a fair amount of experience and knowledge in both languages, and I'll learn whatever else I need to as I go. My concern is the feasibility and effort to accomplish everything I need. I don't have any particular time constraints, but if one language is a fraction of the time of the other then maybe that's a better solution.
Writing it in Java looks like the easiest solution currently, but writing it in C++ has the advantage of being native no-frills code. However, I haven't ever written any web interface or socket code in C++ before, so I do not know the effort involved with that.
To break down my requirements:
Linux
Web interface for control
Named pipe for communicating with client applications
Existing code needs to be heavily refactored
Is C++ or Java more appropriate?
Edit: added more info
Edit2: I guess I should have mentioned that the code needs to be heavily refactored anyways. It was originally written in such a way that renders it difficult to make changes and additions. So rewriting is a cleaner solution at this point. As I mentioned, it's not a large program. Just a controller service.
Porting the solution to .Net Core may the way to go. It will run on Linux (and Mac for all intents and purposes...) and most of your codebase may need minimal refactoring. The only concern is if .Net Core currently has the features you would need supported in the app. And, .Net Core is still in preview.
Related
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 2 years ago.
Improve this question
So I'm currently reading the "Java A Beginners Guide 7th Edition" book. And the following sentences seemed to me that Applets could be used as virusis. Was this done?
An Applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed inside a Java-compatible web browser.
The key feature of applets is that they execute locally...
To me it sounds like it wouldn't be hard to build in a virus into an Applet.
The problem with applets is that they run automatically when you load the page. They're also so complex (compared to html or javascript) it was just to complicated to be able to meaningfully secure them. Run Automatically + Complicated to Secure + Doesn't Update Automatically = impossible to completely secure.
Regular apps are far far more dangerous to your machine than applets were. But, they don't run automatically when you visit a web page.
Desktop apps written in languages (like C or C++) where you manipulate the memory with pointers and don't automatically bounds check arrays, are much harder to write securely. Languages (like Java or C#) that don't have pointers and do automatically bounds check arrays are easier to write secure apps in.
Java includes many safewards to prevent any ill behavior, but time after time, those security features were not enough because of different bugs or design problems.
As standalone apps they are as safe or risky as any other app. Just make sure to download your app from trusted sources.
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 7 years ago.
Improve this question
I have an API in C# .Net for uploading files whose size vary between 10 B - 100 KB. Per second, the system receives around 5 such calls. Now I want to pass this file to a JAVA process (Because it is a producer of Kafka, and we want it to be JVM based, while C# API is legacy). Both are going to reside on the same machine almost always. What is the best way of doing that?
I read about jni4net, IKVM for interacting with Java from C#. Would they be better or should I make it socket based (Web API in Java accepting the files), or should I read from the local filesystem where C# App has uploaded or any other option that I am missing?
In environment with high concurrency, reading from the local file-system might not be good idea.
You could use memory mapped files which java supports with FileChannel.
Depending on operating system, you could also use Named pipes for IPC, here is an article showing how to use pipes between .Net and Java:
http://v01ver-howto.blogspot.com/2010/04/howto-use-named-pipes-to-communicate.html
All options considered, i would go with sockets. They are portable and easy to do and will most likely meet performance requirements you have.
You may also use a message queue. You can either put a binary message, serialize the file or put the location of file on the queue if you are storing the files in the file system.
A solution with sockets and message queues will allow you to have a more distributed architecture i.e. not loading a single machine with too much work.
If you want to actually use the C# API from Java, a bridge is probably the way to go. It'll likely be more efficient than a Web API. Some bridges will also allow you to run the C# and the Java in the same process, which is more efficient still.
In addition to the bridges you mention, you might want to consider JNBridgePro. You can find more information at our website.
Disclosure -- I am affiliated with JNBridge.
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 seem to be confused on a few levels of understanding Java, here is what I am curious about:
Is Java a client-side and server-side language?
Is it more a client-side or server-side, if both are applicable?
I don't know if this is the correct way to put this, if it isn't, please kindly me inform me of where this question would do better.
Thank you so much!
Is Java a client-side and server-side language?
It is a language. It is not specifically client side or server side and it can be used in Blu-ray players and many other devices where there is no client or server.
Is it more a client-side or server-side, if both are applicable?
It is use more widely on the server side.
Why does it perform so poorly either way?
It doesn't perform so poorly. It is less popular on the client as it can require a large download and has suffered some security concerns lately. It also doesn't run on every device whereas Javascript is more widely supported.
JavaScript is a client-side language.
Not true, Javascript can be used in Java and is used on the server side stand alone. see Node.js
Java can be used as either. You can write thick client applications, server applications (web or other), or applets that get embedded in browsers, webstart which is initialized via a browser but launches more like a client-side java application.
Java in the browser is generally a bad idea, there have been many security issues, and, imo (and this is very subjective) it sucks for ui (not the code, but the user experience).
Java has huge market share for server side business applications (web or otherwise) especially in the enterprise space.
Java doesn't perform poorly at all. It often performs on par with compiled code (such as C++). The only challenge with Java is that because it is cross-plaform it will sometimes be challenging to work with platform specific things (e.g. directx).
There is a big difference between Java and Javascript.
You might want to look up both.
Javascript is mostly used as client-side language, and Java is most used for applications and or websites.
It's unclear what you mean with poorly performance, you might want to update your question for that part.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Alright, so for the past while I've been working on an Operating System style Java application. I've got everything loaded up within an undecorated JFrame, and now I'm ready to turn it into a .ISO or something along those lines. My question, is how would I do this? I've seen articles online saying yes, you can have a Java Operating System, and I've seen examples of some, but I'd like to know HOW. Like if I were to load it into some sort of Virtual Machine, I'd like to do what I've programmed it to do.
If you are planning to run your code as the operating system of a virtual machine, then an ISO is a good choice.
There are existing tools for generating ISO's ... provided you have the "stuff" to go into the ISO.
Your problem is generating the stuff that goes into the ISO; i.e. a bootable operating system image. The problem is that the image must be all native code, and it needs to understand all the low level stuff about how the hardware works; e.g. how to deal with physical / virtual memory mapping, I/O device registers, hardware interrupts, and so on. So you have the problems of implementing the classes (or native code) that does that, and compiling your Java classes into native code and linking it together with everything else to form a bootable operating system image. (And that is just the start ... really)
For those things, there are no existing tools (AFAIK), and little in the way of experience to draw on.
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 was reading item #6.10 on http://www.cafeaulait.org/javafaq.html and I began wondering how the big players go about creating their own implementation of a JVM. Would an experimental something or another be possible (and feasible) for one guy?
technically, all the information people need to create a new JVM is in the public specifications for the language and the targetted platform. A JVM would need to behave differently depending on whether it is meant to run on a desktop computer or a mobile phone, even if the bytecode interpretation would be largely identical.
A few places to start looking for information:
http://en.wikipedia.org/wiki/List_of_Java_virtual_machines
Reading The "Java Virtual Machine Specification" by Tim Lindholm
http://www.jcp.org/en/jsr/detail?id=30
From what I have seen of JVM implementations by Sun, IBM or smaller companies like Esmertec, writing a simple JVM is a several man-months project but adding JSR after JSR to support more functionality can take years afterwards.
Now, if all you need is a simple bytecode interpreter, it's not that bad, but it's still quite a bit of code to write.
A handmade JVM would be a great way to learn about virtual machines in general, the issues of program language design (through the JVM spec), and the nitty gritty of parsing and so forth.
If you choose to take it in that direction, you could also explore optimizations, which is where it can get interesting, and you can take research papers and implement their algorithms.
That being said, if you're less interested in the long and arduous task of creating a VM from scratch, you might want to modify an existing open source VM like Kaffe. It will show you what a virtual machine does, but not necessarily how Java code works in Sun's JVM:
Kaffe is a clean room implementation of the Java virtual machine, plus the associated class libraries needed to provide a Java runtime environment.
This way, you could study the details, but dive in to implementing more interesting features.
I understand that, currently, the big players license the Java library from Sun. They then add their own refinements. The main difference between implementations is the bytecode->machine code compiler.
For one thing, you may want to have a look at Apache Harmony They have come a long way, so their project history may actually give you a good idea on the effort required. I myself would not bet on it being feasible for one guy