ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
IF I wrote a java jre6 gui would it work on linux?
Yes (and with almost no alteration or recompiling), Java's specified to be as platform-independant as possible, or rather it defined an abstract generic platform that is then implemented to each supporting real OS. The Java Runtime Environment is this standard that all Java expects to run in. It's a bit like a lightweight Virtual Machine. Windows, Linux, smartphones, many devices support this standard or cut-down derivatives.
Quote:
Originally Posted by schmitta
Is there a visual java like visual basic?
The answer to this depends whether you're asking can you create graphical user interface with all the usual widgets like buttons, text fields, scroll bars, etc, or if you wish to develop you application in some form of drag&drop hand-holding environment. I believe the latter is what the mention of VisualAge and plugins for Netbeans/Eclipse were in reference, but the answer to the former is yes, there's even several options for Java GUIs, typically Swing is favoured, but there's AWT and SWT also.
Similar to many other languages, Java can also call C/other code, via the Java Native Interface. This should allow you to maintain a single common GUI for Windows or Linux users, and still delegate any platform specific/very low level device interaction to another language. Or you can stick with the design of seperate GUI and device communication processes and use an IPC mechanism as described above.
I'm putting this link for the Java documentation here, it's always a good place to start any specific development and to get an good understanding of how all these things relate. Note the JRE/JavaSE API area, and the Integration Libraries row. CORBA as mentioned previously for IPC is behind the IDL option, and database communication is JDBC.
I too would favour using the Model-View-Controller paradigm/pattern and have the database as the persistent go-between which means devices and users are completely seperate and can use any language/mechanism that can talk to the database/understand SQL.
Many languages have similar features to Java, as mentioned Python and C++ are common for stand-alone apps, and most can be used within/with a web server to use HTML as your GUI. Otherwise you need to choose a widget toolkit, such as Qt, WxWidgets, GTK+, etc.
Cygwin sounds overkill, (DR)DOS shouldn't be needed either.
It would indeed be quite easy to have several web services or virtual directories within the one webserver that are independant and have different access setups, via configuration in the web server as well as your network firewall settings (which could be those managed on the local machine that's running the web server or some larger infrastructure/dedicated firewall device). A couple of lines of config/rules in a standard OS/software firewall should cover this, and you end up maybe with 2 different URLs/using 2 different portnumbers.
Last edited by Proud; 08-03-2011 at 04:32 AM.
1 members found this post helpful.
Click here to see the post LQ members have rated as the most helpful post in this thread.
To communicate between a program and LAMP, set the program on the floor beside the LAMP, plug in the LAMP in the nearest wall-socket, then go have a beer.
The prolem with JAVA is that it is a closed system. I still have to communicate serially with my devices from the PC. I will be using a RS485 to USB converter but JAVA has problems talking to USB from windows. I guess I could write a driver in C and have it communicate with java via a file or database. I can have a database and server all in java which would be nice.
+1 on the earlier post about using a scripting language (python, perl, ruby). A working prototype might just be good enough for production in this environment. Pretty easy to write deamons/services as well as front-ends as well, and it will be faster. If you know C I'd recommend python.
--
Quentin
Will your system require a computer of any sort that must be attached to the special network full-time? If yes, then you could provide a closed-architecture Linux system on an inexpensive single-board computer dedicated to the job. Then you don't have to worry about support of Windows end-users with issues like installation and other hassles. You said you were going to use RS-485 in your controller network, so a SBC with 485 already in place addresses that issue, too. The connection to the host network then just needs ethernet, which can be a DHCP configuration, and you've taken end-user hassles almost right out of the equation.
I have been told that my units should sell for $50. I really cannot say that the price is $50 for that would start the patent clock. But $50 is rediculus (?) . I think some systems sell for $25000.00. I have two groups to sell to. One is wholesale nurseries with about 50 valves (fifty of my units) to control. The other is oneses and twoses who's group size is probably larger than the large scale nurseries. I have enhanced my device to maybe handle that group without the need of an extra PC. But if they want the full use of the device they would need a pc. The smallest pc (MINI-ITC?) is about $200. With Windows I could make them pay for the software and a RS485 to USB interface. Then use there own already purchased computer . But if it turns out that the small user can use the device without a pc then I could sell a $200 pc as an add on appliance and use linux. It does not come down to what we want but to what the market will bear. Large groups have lots of money but small groups do not. It probably depends on the size of the market. There are not a lot of oneses and twoses. It is not about greed but fear of making it through year one or two. Thanks for bearing with me with my rant and what do you think?
I think you didn't answer the question of whether your scheme requires full-time attachment by some kind of computer. My basis for the question is that people probably don't want to have a computer that they use for general-purpose use tied up doing plant watering supervision. If that is a requirement, then I would think that it would be an attractive feature (as well as saving you some development effort) to have a dedicated supervisory computer. Doing so would allow you to create a turn-key package using whatever platform you choose.
The device requires a computer (PC) to use all of its functions but can operate standalone with certain restrictions. No control will be allowed over the internet except in a very secure way with the user taking all the responsibility for failure . Only viewing of the system will be allowed for most instances over the internet. Thus to use all of the device's functionality a local PC will be required. This will most likely be a program (GUI) . If the user does not want to record the status of the system every minute or so they can just use the PC to set variables in the device. Since most people will already have a PC and Windows I was going to sell them a RS485 to USB convertor. Every thing else for the gui would be running as a widowns program. To force a user to buy a $200 computer just to set variables in the device seems to be over bearing.
Today I had at least 6 blue screens. When I first turned the machine on I got 14,000+ updates to the windows registry because (I guess) WINDOWS UPDATE installed an update on "Update Tuesday" (which happened on wednesday). Microsoft dedicated 3 hours today (also 3 hours of my time) and more tomorrow to the problem.
I do not really want to depend on windows on the PC that communicates to my devices. So I will develope a Linux based PC including database and server capabilities for systems greater than two devices. It will be in Java Swing so it will be able to migrate to windows and macintosh. The windows/macintosh version will allow a small database but no server and be marketed to one device users. A Linux based PC is more under my control and allows me to fix the version number so that changes will not break my system. I would choose UBUNTU 10.4 (UBUNTU was the only version that installed to disk for me out of all the Linux versions I tried - 11.4 broke for me). I would probably use a mini-itx system as it is cheap. The security that Linux would not break and that it's version could be fixed and stable would allow me to sleep at night. If people want to upgrade to security then they can choose a Linux appliance .
FWIW on Windows XP and beyond, a bluescreen is rare and typically either failing hardware, or a dodgy 3rd party device driver.
Ubuntu 10.04 seems to be a Long Term Support version, which is what you want to look for, rather than a more frequently updated release from Canonical or any other distro producer.
If a version of Ubuntu works on your hardware, it's likely any linux distro could, it's just which one has the default settings and possibly proprietary device drivers bundled in to make it smooth.
Windows or Linux, you'll always have 2 concerts w.r.t. updates: providing your own should security flaws or bugs be found in your software; and compatability with fixes produced for similar updates to the OS. Granted, Linux installs can quite easily be trimmed to leave less things installed and so less 'surface area' of running services or executable code to cause such updates to be needed, but either OS could produce a conflicting fix and then it'll be down to if you will support that release or cause people to have to choose between updating their OS or your software.
If you're talking which OS to put on a dedicated device, obviously there's far less chance of requiring an OS update that also causes issues with your product, and you can probably skip most updates, but you'll still be more responsible for this machine if it's living within your customers' networks.
Java may be a problem. I need a service (daemon) to run all the time collecting data from the devices. Can I run two copies of jvm with one running as a permanent service writing data received to a database and then running the second jvm with gui (swing) accessing the same database to give the user data and to leave messages for the service jvm to send to the devices on the serial network?
Yes. Just like running any other combo of programs, or multiple instances of regular ones afaik. The different instances don't even need to be using the same JRE versions.
It's down to how you plan your database and transactions/interactions with it that'll determine if you cause concurrency issues, same with any language.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.