|Posted by jdixon on Jan 19, 2016 12:00 AM|
LXer; By James Dixon
Two methods to get Jstock working on your Slackware 14.1 machine.
Jstock is an open source program for tracking and analyzing your investments. It includes analysis and charting software to aid you in picking stocks you may wish to investigate further. It is a full featured product on par with those offered by the various online stock brokerages (Etrade, TD Ameritrade, and Scottrade, for example). There is a website for the jstock software (http://jstock.org/), from which you can download the latest versions and the source code.
LXer recently linked to a full review of jstock (which you can find at http://xmodulo.com/stock-portfolio-management-software-linux...). This article is not intended to be review of the software but rather a walkthrough describing how to get it working with Slackware.
There are two ways to install jstock on your Slackware system. The first is to manually install it in your own user directory. The second is to use sbopkg to install it. I will discuss both methods.
To manually install jstock in your own directory, first download the latest version from the jstock website and save it to your home directory. At the time of this article that is version 220.127.116.11, and the file to download is jstock-18.104.22.168-bin.zip. Open terminal of your choice, cd to your home directory, and issue the following commands:
chmod 755 jstock.sh
Assuming you have a current version of Java installed (jstock is written in java and requires that Oracle's Java 8 be installed to run) you can start jstock by cd'ing to the jstock directory and typing:
You can, of course, create a launcher to run this program from your desktop or a menu if you wish to do so, but that's beyond the scope of this article, as is the process for installing the correct version of jdk without using sbopkg.
This method allows you to always have the latest version of jstock and run it on your system without using the root account. But it is not a system wide installation. If you want anyone on your system to be able to use jstock, then you need to install it as root. The best way to do so is, in my opinion, using the sbopkg program (installation of the sbopkg program was covered in an earlier LXer article which can be found at http://lxer.com/module/newswire/view/224569/index.html).
To install jstock using sbopkg you do the following:
Open the terminal of your choice. Enter su - to become root.
Start sbopkg by entering sbopkg at the command prompt.
At this point I need to briefly describe how to use the sbopkg menus for those not familiar with it. From the main menu you can select the actions of Sync, Packages, Updates, Browse, Search, Queue, Utilities, and Help. The menu includes a brief description of what each selection does. Within sbopkg, you can normally use the arrow keys to select your menu option, use the mouse to select it, or press the letter key for the appropriate menu option. The arrow keys will not allow you to move to the action items at the bottom section of the display. To select them you use either the tab key or the mouse. Selecting the action with the tab key requires you to hit the enter key to perform the action, while clicking on it with the mouse normally runs it without any other action (but see the walkthrough below for an exception). If you do tab down to the action items, you can select your actions with the arrow keys, the tab key, or the mouse.
First, you want to be sure that you have a current list of software packages, so you select Sync, and OK. This will sync your local repository with the remote one, making sure that your package list is up to date.
Once the repository is synced, you select Exit to return to the main screen. In my case, using the mouse to select exit did not activate it (probably because it is the only action option), so I had to hit enter to return to the main screen.
Now you want to see if jstock is available in the SBo repository. You select Search, enter jstock in the text field, and select PKG.
You should get a "Matches for jstock" screen with a single entry, indicating that jstock is available in the misc category and has the description of "Stock Market Software". Since this is the only match, it is already selected, so you now select OK to pull up the package screen for the jstock package.
From this menu you have the options to View the README file, View the .info file, View the Slackbuilds file, Choose any file to display, Customize the .info or Slackbuild file, Remove the jstock sources in cache, Edit Build Options/Flavors, Check the GPG signature of the SBo tarball, Re-extract the SBo tarball, Add jstock to the queue, and Download/build/install jstock.
You first want to view the README file to determine if jstock has any dependencies. So select View the README file and OK.
This brings up the README file included with the Slackbuilds tarball for jstock. It is a screen with a brief description of the software, the version information, and a list of any dependencies the package may have. It tells us that this is version 22.214.171.124 of jstock and at the bottom of this screen it says Requires="jdk". This means that the SBo repository does not yet have the latest version of jstock (which is 126.96.36.199), and the Requires entry means that the jdk package is a required dependency for the jstock package. In some cases the dependency is only required for the package to run and the package can be installed without it. In other cases the dependency is required to compile or install the package. Since you can't know which, it's usually best to install dependencies before installing the package. There are ways around the repository not having the latest version of the software, but they're beyond the scope of this article, and we'll simply install the older version.
So now you know that you need the jdk package. Assuming you do not have already have jdk installed, you need to find and install it.
To do so, select OK to go back to the jstock action screen, select Main Menu to go back to the main menu screen, select Search and OK to get back to the search screen (in this case, you could also select Back and Back to get to the search screen), enter jdk, and select PKG. This should return the Matches screen with two results: the jdk package which is Oracle's Java, and the openjdk package. You want the jdk package, so select it and select OK.
This brings up the package screen for the jdk package. Select README and OK to see the README file for the jdk package. The version information shows that version is jdk-8u66, which is the version you need, and at the bottom of this screen you will see that the Requires entry is blank. This means that the jdk package does not have any dependencies. Select OK to go back to the jdk package screen.
To install the jdk package, you now select Process and select OK. The brings up the process type screen which gives you options to Download the package, Build the package, or Install the package. To install the package, you select Install and select OK. This will bring up a Pre-Check screen with some basic information about the process. Select Start to begin downloading the software and creating the package. Once the install is completed, you will get a "Press any key to continue" prompt at the bottom of the screen. Pressing any key should return you to the sbopkg jdk package menu.
At this point I should give a word of warning. The jdk files from Oracle's website seem to be very finicky about downloading. I can't count the number of times I've tried to install this package and had it error out because the download did not complete properly. The last time I installed the jdk package, I had to manually download the file from Oracle myself and copy it to the appropriate location for sbopkg to use it, and it still took three tries to get a good download. Assuming the download is successful however, the jdk package should install with no problems.
Now that the jdk package is installed, we can install the jstock package. So select Main Menu to go back to the main menu, select Search and OK to bring up the search screen. Enter jstock and select PKG to bring up the Matches screen, and select OK to bring up the jstock package screen. At this screen, you now select Process and OK to bring up the process type screen, select Install and OK to bring up the Pre-check screen, and select Start to begin the process. Again, the process should complete with no errors and you should get a "Press any key to continue" prompt at the bottom of the screen. Pressing any key should return you to the jstock package screen.
From here, you can select Main Menu to return to the main menu, then select Packages and OK to pull up a list of your installed SBo packages. If everything has gone correctly both jdk and jstock should be in your list of installed packages.
Select Cancel and Exit to exit sbopkg. You should now have a working version of jstock installed which can be run by any user on your system by typing the command "jstock" from a terminal window.
Again, you can create a launcher to run the program from the desktop or a menu. but that's beyond the scope of this article.
This is the second in what I hope to be a series of Slackware oriented articles on LXer. Comments may be made via my LXer account or in the discussions.