Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!

Rebecca Witmer

Ranch Hand
+ Follow
since Sep 10, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rebecca Witmer

Wow, I had never heard of JSTL. I have only ever used scriptlets in JSP.
11 years ago
JSP
Okay, so I know this is in the first chapter of whatever JavaRanch recommended book I read on JSP long ago, but I haven't written any JSP (or Java for that matter) in a long time, so I can't remember how to do this.

So far this is what I have done:
Installed Tomcat
Installed MySql
Made a DB
Wrote an HTML page to send data to a JSP
Got those values in the JSP
Queried the database with those values
Got output
Displayed it

This all works great, but the code is really ugly. Now I want to put that database access code into a class file. That way it's not clogging up my JSP. I have a vague recollection of how to do this, but can't remember exactly. I think what you are supposed to do is something like this.

Make a java file
Compile it (?)
Put the .class into a jar (or the .java?)
Put the .jar into a directory (WEB-INF? WEB_INF/classes?)
Import the .jar

Is that right? Exactly how is this done? Where is the jar supposed to go? Is there an example of this somewhere I can try to get working minimally before I start messing with my already written code? It would be nice to see a tutorial that gives you an itty-bitty JSP that imports a class that just returns a string so that the JSP can print it, and shows you how to jar everything up and where to put each piece of the code.

Can someone explain this or point me at a good reference? Everything I have seen so far just confuses me more.

Thanks!
11 years ago
JSP
I know how to write a servlet and how to write a JSP but I keep hearing people talk about these other technologies. I read about them somewhat on the wikipedia but I don't have a very good idea how the terms relate to each other. JSPs and Servlets are pretty basic units. I gather that these other technologies are more like ways of using them. Even more different, web services seem like they are a concept, not really a specific technology.

Somebody help me out with the big picture here. How do these technologies relate to each other? How are they the same or different? What is one good example of an application that would lend itself well to being written in each? Is there anything else I should've included in the list to get a full understanding?

Anything anyone wants to throw out there will be very helpful.
Thanks.
[ September 18, 2006: Message edited by: Rebecca Witmer ]
14 years ago
It seems CvgActionServlet imports ModelConfig here:



And calls the getInstance method on it here:


ModelConfig seems to be in the appropriate place in the jar file and begins like this:



At the bottom of the decompiled code it declares the variable it was talking about:



It seems like the method is there...
14 years ago
My struts config looks like this. XMLSpy thinks it is well-formed and validated.


[ September 08, 2006: Message edited by: Rebecca Witmer ]
14 years ago
If you decompile the class that it is asking for it looks like this:


[JE: edited long line]
[ September 11, 2006: Message edited by: Joe Ess ]
14 years ago
Well this is what it says:


CvgActionServlet is inside of pf-web.jar. I just looked inside it with WinZip. Do you suppose it could be that it's loading the classes before it loads that library and that's what's making it crash?

[ September 08, 2006: Message edited by: Rebecca Witmer ]
[ JCE: Edited long line]
[ September 08, 2006: Message edited by: Joe Ess ]
14 years ago
It says this:

META-INF/
META-INF/MANIFEST.MF
applet/
html/
html/gen/
html/gen/iwd/
html/gen/iwd/ZipCode/
images/
images/icons/
images/icons/task/
images/layout/
images/layout/buttons/
images/layout/menu/
images/layout/screen/
images/logo/
images/menu/
js/
jsp/
jsp/error/
jsp/gen/
jsp/gen/iwd/
jsp/gen/iwd/ZipCode/
jsp/hierarchy/
jsp/navigation/
jsp/templates/
platform/
platform/css/
platform/images/
platform/js/
platform/jsp/
platform/styles/
styles/
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/com/
WEB-INF/classes/com/convergys/
WEB-INF/classes/com/convergys/csm/
WEB-INF/classes/com/convergys/csm/app/
WEB-INF/classes/com/convergys/csm/app/web/
WEB-INF/classes/com/convergys/csm/app/web/actions/
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/zipcode/
WEB-INF/classes/com/convergys/webx/
WEB-INF/classes/com/convergys/webx/app/
WEB-INF/classes/com/convergys/webx/app/web/
WEB-INF/classes/com/convergys/webx/app/web/actions/
WEB-INF/classes/config/
WEB-INF/classes/config/web/
WEB-INF/classes/config/web/i18n/
WEB-INF/config/
WEB-INF/config/web/
WEB-INF/config/web/gen/
WEB-INF/config/web/struts/
WEB-INF/config/web/struts/gen/
WEB-INF/config/web/struts/gen/iwd/
WEB-INF/config/web/struts/gen/iwd/ZipCode/
WEB-INF/config/web/tiles/
WEB-INF/config/web/tiles/gen/
WEB-INF/config/web/tiles/gen/iwd/
WEB-INF/config/web/tiles/gen/iwd/ZipCode/
WEB-INF/config/web/tlds/
WEB-INF/config/web/validations/
WEB-INF/config/web/validations/gen/
WEB-INF/config/web/validations/gen/iwd/
WEB-INF/config/web/validations/gen/iwd/ZipCode/
WEB-INF/gen/
WEB-INF/lib/
WEB-INF/lib/pf/
applet/aopalliance.jar
applet/commons-logging.jar
applet/genHierApplet.jar
applet/log4j.jar
applet/pf-javaclient.jar
applet/spring.jar
html/gen/iwd/ZipCode/ZipCodeSearchCriteria.html
html/gen/iwd/ZipCode/ZipCodeSearchResults.html
images/clear_sh.gif
images/icons/account_d.gif
images/icons/account_e.gif
images/icons/account_icon.gif
images/icons/attention.gif
images/icons/attention_small.gif
images/icons/bcgroup_d.gif
images/icons/bcgroup_e.gif
images/icons/bcsummary_d.gif
images/icons/bcsummary_e.gif
images/icons/bc_d.gif
images/icons/bc_e.gif
images/icons/bundle_icon.gif
images/icons/calendar.png
images/icons/carte_icon.gif
images/icons/contact_e.gif
images/icons/cross.gif
images/icons/customer_d.gif
images/icons/customer_e.gif
images/icons/customer_expand_combo_d.gif
images/icons/customer_expand_combo_e.gif
images/icons/drop.gif
images/icons/expand_indicator_d.gif
images/icons/expand_indicator_e.gif
images/icons/filler_button.gif
images/icons/hierbill_e.gif
images/icons/icon_account.gif
images/icons/icon_alacarte.gif
images/icons/icon_bundle.gif
images/icons/icon_info.gif
images/icons/icon_question.gif
images/icons/icon_stop.gif
images/icons/icon_warn.gif
images/icons/icon_warn_small_inline.gif
images/icons/package_d.gif
images/icons/package_e.gif
images/icons/product_d.gif
images/icons/product_e.gif
images/icons/red_asterisk.gif
images/icons/red_asterisk2.gif
images/icons/red_asterisk_disabled.gif
images/icons/root_expand_combo_e.gif
images/icons/root_node_e.gif
images/icons/search.gif
images/icons/search_e.gif
images/icons/task/cust.png
images/icons/task/task_d.png
images/icons/task/task_nr.png
images/icons/task/task_r.png
images/icons/ungroupeditems_e.gif
images/layout/buttons/button_bg.gif
images/layout/buttons/button_hover_bg.gif
images/layout/buttons/button_inactive_bg.gif
images/layout/menu/additional_actions.gif
images/layout/menu/app_holder.jpg
images/layout/menu/arrow_down.gif
images/layout/menu/arrow_down_hilite.gif
images/layout/menu/arrow_right.gif
images/layout/menu/arrow_up.gif
images/layout/menu/arrow_up_hilite.gif
images/layout/menu/border_bottom.jpg
images/layout/menu/border_left.jpg
images/layout/menu/border_right.jpg
images/layout/menu/border_top.jpg
images/layout/menu/config_img.gif
images/layout/menu/corner_bot_left.jpg
images/layout/menu/corner_bot_right.jpg
images/layout/menu/corner_left_bottom.gif
images/layout/menu/corner_left_top.gif
images/layout/menu/corner_right_bottom.gif
images/layout/menu/corner_right_top.gif
images/layout/menu/corner_top_left.jpg
images/layout/menu/corner_top_right.jpg
images/layout/menu/corner_white_left.gif
images/layout/menu/corner_white_right.gif
images/layout/menu/csm_r1_c1.jpg
images/layout/menu/csm_r1_c2.jpg
images/layout/menu/csm_r1_c3.jpg
images/layout/menu/dot.gif
images/layout/menu/dwn_arrow.gif
images/layout/menu/dwn_arrow_lt.gif
images/layout/menu/expand.gif
images/layout/menu/full_search_ico.jpg
images/layout/menu/h2_header_bg_line.jpg
images/layout/menu/hor_bot.gif
images/layout/menu/hor_bot2.gif
images/layout/menu/hor_top.gif
images/layout/menu/hor_top_white.gif
images/layout/menu/left_header_bar.jpg
images/layout/menu/lgot_lower_left.gif
images/layout/menu/lgot_lower_right.gif
images/layout/menu/menu_bg_blue.jpg
images/layout/menu/menu_bg_white.jpg
images/layout/menu/menu_bottom_logout.jpg
images/layout/menu/menu_nav_blue.gif
images/layout/menu/menu_nav_bottom.gif
images/layout/menu/menu_nav_bottom_white.gif
images/layout/menu/menu_nav_left_side.gif
images/layout/menu/menu_nav_lower_spacer.gif
images/layout/menu/menu_nav_ride_side.gif
images/layout/menu/menu_nav_top.gif
images/layout/menu/menu_nav_top_spacer.gif
images/layout/menu/menu_top.jpg
images/layout/menu/menu_top2.jpg
images/layout/menu/middle_header_bar.jpg
images/layout/menu/right_header_bar.jpg
images/layout/menu/rt_arrow.gif
images/layout/menu/rt_arrow_lt.gif
images/layout/menu/small_vert.gif
images/layout/menu/spacer.gif
images/layout/menu/vert_black_line.png
images/layout/menu/vert_blue_left.gif
images/layout/menu/vert_blue_line.gif
images/layout/menu/vert_blue_right.gif
images/layout/menu/vert_white_left.gif
images/layout/menu/vert_white_right.gif
images/layout/screen/background.gif
images/layout/screen/fake_AH.png
images/layout/screen/fake_header.png
images/layout/screen/fake_nav.png
images/layout/screen/fake_news.gif
images/layout/screen/header.gif
images/layout/screen/login.gif
images/logo/211_bb.gif
images/logo/211_login.gif
images/logo/22_login.gif
images/logo/branding_bar_bg.gif
images/logo/branding_bar_bg.png
images/logo/branding_bar_l.gif
images/logo/branding_bar_l.png
images/logo/branding_bar_R.gif
images/logo/branding_bar_R.png
images/menu/avail_actions_d.gif
images/menu/avail_actions_e.gif
images/menu/icon_actions.png
images/menu/logo.png
js/jsCSMHierarchyFunctions.js
jsp/error/error.jsp
jsp/error/noprivError.jsp
jsp/error/wizardExpired.jsp
jsp/gen/iwd/ZipCode/ZipCodeSearchCriteria.jsp
jsp/gen/iwd/ZipCode/ZipCodeSearchResults.jsp
jsp/hierarchy/exampleNodeDetails.jsp
jsp/hierarchy/genericHierarchy.jsp
jsp/navigation/navbar.jsp
jsp/templates/brandingBar.jsp
jsp/templates/errorLayout.jsp
jsp/templates/footer.jsp
jsp/templates/header.jsp
jsp/templates/headerNoReq.jsp
jsp/templates/layout.jsp
jsp/templates/layoutNoNav.jsp
jsp/templates/layoutWithButtonPanel.jsp
jsp/templates/layoutWithButtonPanelNoNav.jsp
jsp/templates/layoutWithHierarchy.jsp
jsp/templates/layoutWithOnLoadScript.jsp
jsp/templates/messages.jsp
jsp/templates/searchLayout.jsp
jsp/templates/validationScripts.jsp
platform/css/locked_column.css
platform/css/webCalendar.css
platform/css/webCvgErrors.css
platform/css/webNavMenu.css
platform/css/webTable.css
platform/images/arrow_down.gif
platform/images/arrow_up.gif
platform/images/clear_sh.gif
platform/images/icon_warn_small_inline.gif
platform/images/menu_arrow_down.gif
platform/images/menu_arrow_right.gif
platform/images/menu_nav_bottom.gif
platform/images/menu_nav_side.gif
platform/images/menu_nav_top.gif
platform/images/vert_black_line.png
platform/images/vert_blue_line.gif
platform/images/webCalendar.gif
platform/images/webCalendarNavLeft.gif
platform/images/webCalendarNavRight.gif
platform/js/accumulatorTag.js
platform/js/performCheckAll.js
platform/jsp/brandingBar.jsp
platform/jsp/errorLayout.jsp
platform/jsp/footer.jsp
platform/jsp/header.jsp
platform/jsp/layout.jsp
platform/jsp/layoutWithNavbar.jsp
platform/jsp/layoutWithNavbarAndTable.jsp
platform/jsp/layoutWithNoPermissionNavbar.jsp
platform/jsp/layoutWithOnLoadScript.jsp
platform/jsp/loginRealm.jsp
platform/jsp/manageTimers.jsp
platform/jsp/messages.jsp
platform/jsp/navbarTst1.jsp
platform/jsp/noPermissionNavbar.jsp
platform/jsp/redirectLogin.jsp
platform/jsp/table.jsp
platform/jsp/timerDetails.jsp
platform/jsp/webCalendarI18N.jsp
platform/styles/button_style.css
platform/styles/iframe_styles.css
platform/styles/menu_style.css
platform/styles/styles.css
styles/button_style.css
styles/locked_column.css
styles/menu_style.css
styles/styles.css
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/zipcode/ZipCodeSearchCriteriaInputSvcViewAction.class
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/zipcode/ZipCodeSearchCriteriaOutputSvcRequestAction.class
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/zipcode/ZipCodeSearchResultsInputSvcViewAction.class
WEB-INF/classes/com/convergys/csm/app/web/actions/iwd/zipcode/ZipCodeSearchResultsOutputSvcRequestAction.class
WEB-INF/classes/com/convergys/webx/app/web/actions/IDatabaseController.class
WEB-INF/classes/com/convergys/webx/app/web/actions/MyNotesProcessor.class
WEB-INF/classes/com/convergys/webx/app/web/actions/MyNotesServiceProcessor.class
WEB-INF/classes/com/convergys/webx/app/web/actions/MySQLDatabaseController.class
WEB-INF/classes/com/convergys/webx/app/web/actions/QueryParam.class
WEB-INF/classes/com/convergys/webx/app/web/actions/ZipCodeServiceProcessor.class
WEB-INF/classes/com/convergys/webx/app/web/actions/ZipCodeTableProcessor.class
WEB-INF/classes/config/web/i18n/iwd.properties
WEB-INF/classes/config/web/i18n/webx.properties
WEB-INF/classes/config/web/i18n/webx_en_US.utf8
WEB-INF/classes/cvg_extensions.properties
WEB-INF/classes/pf-registry-spring.xml
WEB-INF/classes/WebLogicLauncher.class
WEB-INF/config/web/gen/zipcode-FunctionConfig.xml
WEB-INF/config/web/iwd-function-config.xml
WEB-INF/config/web/struts/gen/iwd/ZipCode/zipcode-struts-config.xml
WEB-INF/config/web/struts/hier-example-struts-config.xml
WEB-INF/config/web/struts/hierarchy-struts-config.xml
WEB-INF/config/web/struts/struts-config.xml
WEB-INF/config/web/tiles/gen/iwd/ZipCode/zipcode-tiles-defs.xml
WEB-INF/config/web/tiles/hier-example-tiles-defs.xml
WEB-INF/config/web/tiles/tiles-defs.xml
WEB-INF/config/web/tlds/cvgwsf-i18n.tld
WEB-INF/config/web/tlds/struts-bean-1.1.tld
WEB-INF/config/web/tlds/struts-bean-el.tld
WEB-INF/config/web/tlds/struts-bean.tld
WEB-INF/config/web/tlds/struts-form.tld
WEB-INF/config/web/tlds/struts-html-1.1.tld
WEB-INF/config/web/tlds/struts-html-el.tld
WEB-INF/config/web/tlds/struts-html.tld
WEB-INF/config/web/tlds/struts-logic-1.1.tld
WEB-INF/config/web/tlds/struts-logic-el.tld
WEB-INF/config/web/tlds/struts-logic.tld
WEB-INF/config/web/tlds/struts-nested-1.1.tld
WEB-INF/config/web/tlds/struts-nested.tld
WEB-INF/config/web/tlds/struts-tiles-1.1.tld
WEB-INF/config/web/tlds/struts-tiles-el.tld
WEB-INF/config/web/tlds/struts-tiles.tld
WEB-INF/config/web/tlds/struts.tld
WEB-INF/config/web/tlds/taglibs-input.tld
WEB-INF/config/web/tlds/taglibs-request.tld
WEB-INF/config/web/tlds/webx-tags.tld
WEB-INF/config/web/validation.xml
WEB-INF/config/web/validations/gen/iwd/ZipCode/zipcode-validation.xml
WEB-INF/config/web/validator-rules.xml
WEB-INF/config/web/webx-validator-rules.xml
WEB-INF/config/web/WebxFunctionConfig.xml
WEB-INF/config/web/WebxHierarchyConfig.xml
WEB-INF/config/web/WebxHierConfig.xsd
WEB-INF/config/web/WebxLocaleConfig.xml
WEB-INF/config/web/WebxLocaleConfig.xsd
WEB-INF/config/web/WebxNavigationConfig.xml
WEB-INF/gen/zipcode-web.xml
WEB-INF/gen/ZipCodeModel_1_5557-model-config.xml
WEB-INF/gen/ZipCodeModel_1_9549-model-config.xml
WEB-INF/iwd-config.xml
WEB-INF/iwd-model-config.xml
WEB-INF/iwd-table-config.xml
WEB-INF/lib/aopalliance.jar
WEB-INF/lib/axis.jar
WEB-INF/lib/commons-beanutils.jar
WEB-INF/lib/commons-collections.jar
WEB-INF/lib/commons-digester.jar
WEB-INF/lib/commons-discovery.jar
WEB-INF/lib/commons-logging.jar
WEB-INF/lib/commons-validator.jar
WEB-INF/lib/genHierApplet.jar
WEB-INF/lib/ibmxml.jar
WEB-INF/lib/ipd-interfaces.jar
WEB-INF/lib/j2ee.jar
WEB-INF/lib/jaws.jar
WEB-INF/lib/jaxb-api.jar
WEB-INF/lib/jaxb-impl.jar
WEB-INF/lib/jaxb-libs.jar
WEB-INF/lib/log4j.jar
WEB-INF/lib/mysql-connector-java-3.1.6-bin.jar
WEB-INF/lib/namespace.jar
WEB-INF/lib/pf-container.jar
WEB-INF/lib/pf-j2ee.jar
WEB-INF/lib/pf-javaclient.jar
WEB-INF/lib/pf-web.jar
WEB-INF/lib/spring.jar
WEB-INF/lib/struts-el.jar
WEB-INF/lib/struts.jar
WEB-INF/lib/taglibs-request.jar
WEB-INF/lib/webx.jar
WEB-INF/lib/xercesImpl.jar
WEB-INF/lib/xml-apis.jar
WEB-INF/model-config.xml
WEB-INF/pf-extensibleAttributes-spring.xml
WEB-INF/pf-web-spring.xml
WEB-INF/web.xml
WEB-INF/web.xml.orig
WEB-INF/weblogic.xml
WEB-INF/webx-config.xml
WEB-INF/webx-web-spring.xml
14 years ago
I have an application that is WARred up in the typical J2EE fashion. There are a bunch of 3rd party JAR files that need to be included in its lib folder. I put them in there and deployed the WAR, but when weblogic starts up it gives all these errors about not being able to find certain classes from the JARs. As an alternative, I tried putting the paths to those JARs in the CLASSPATH system variable and it worked.

Why doesn't weblogic find my JAR files if they are inside \WEB-INF\lib? Is it something to do with the order things are loaded by the classloader? Could it be that it's trying to load my classes first and the library JARs second when I put those JARs in the lib? Would it load the JARs first when I put them in the CLASSPATH instead?

Why can't it see my JARs?? >:-
14 years ago
After five days of banging my head on this problem I have found somewhat of an answer. For some reason swing only wants to refresh the scrollbar if an event occurs. When someone clicked in my tree and event occurred and it was happy about running the setValue command to scroll the bar to the top. However, my ultimate goal was to change the text each time someone clicked in the tree, which would set the scroll bar back to the bottom. So I needed another type of event to occur that would not involve the user clicking. After all, what I am trying to avoid in the first place is making the user drag the scrollbar back to the top. So it occurred to me to do the following...




...and add a method like this.



If I ever want to put the scroll bar at the top I just call timer.start();. The setValue() method will run inside the event even though it won't other places. I hope that helps someone in the future. Does anybody with any better knowledge of the way this all work have an explanation as to why it behaves this way? Is it a bug in Swing?
16 years ago
I am trying to figure out what would make a command work in one place but not in another. In my code I have a scrollPane initialized to hold some text.



After the code is first set up the scroll bar is at bottom. Then I have a listener that runs.

public void valueChanged(TreeSelectionEvent e) {
htmlView.getVerticalScrollBar().setValue(0);
}

When you click on something all it does is run the stubborn command above. In the listener it works! What is going on?

Baffledly,
Rebecca
16 years ago
Okay, so I have been pondering this some more and I've come up with a lot of confusing data. Is there another way to do this scrollpane stuff? I am baffled. Maybe someone else won't be. Here's what I've come up with:

There are two scroll panes side-by-side in my gui. The left one has a tree of stuff you can click on to see metadata about it in the left side. Here's some code I have for setting up the panes (partially):



So that's at the beginning. When it first sets up the panels it always tells me:
Value of scrollbar is 0
Value of scrollbar is 0
That's right because the default is for there to be no vertical scrollbar unless the text stretches it out. Since there's no text yet, no scrollbar. Thus its value is 0.

Then I have added this to the code that runs when you click something on the left. I tried all _kinds_ of stuff to get it to behave:



But nothing works. The scroll bar stays not at the very bottom, but one or two pixels away, exactly at the bottom of the final character. Here's some output:

Value of scrollbar is 0 <---Initial values
Value of scrollbar is 0


Value of scrollbar before value changed is 0 <---After I clicked something
Value of scrollbar after value changed once is 0
Maximum is 295
Minimum is 0
Value of scrollbar after value changed twice is 0


Value of scrollbar before value changed is 252 <---The 2nd thing clicked
Value of scrollbar after value changed once is 0
Maximum is 295
Minimum is 0
Value of scrollbar after value changed twice is 0


Value of scrollbar before value changed is 86 <---Dragged the s.b. to the
Value of scrollbar after value changed once is 0 <---middle then clicked
Maximum is 295
Minimum is 0
Value of scrollbar after value changed twice is 0

If you take out setting the size of the JEditorPane to 295 and just let it figure out its own size it will say that the value of the scrollbar is 25 or 40 depending whether you add on another "Y" or not. That is, it sets the size and scroll bar value to match the amount of text.

I don't get why it wants to be at the bottom but at this point I am so baffled that I am willing to trash this idea and try another way. Is there another elegant way to do this?

Thanks,
Rebecca
16 years ago
I want my vertical scroll bar to initialize to the top but it always seems to start somewhere a few pixels from the bottom. I thought that this was the way to do it...

(html view is a JScrollPane)
htmlView.getVerticalScrollBar().setValue(0);
int val = htmlView.getVerticalScrollBar().getValue();
System.out.println("Value of scrollbar is " + val);

...but it always prints 0 while putting the scroller near the bottom. The docs seem to suggest that 0 is the value for "top". What did I do wrong? Thanks for any thoughts.
16 years ago
I have the following small method in my code. spt is a thread. Why doesn't isInterrupted() always return true? It always prints "false".
Rebecca

public void stopSegment( ) {
if (segmentPlaying){
segmentTimer.stop( );
segmentLine.stop();
segmentLine.flush();
segmentLine.close();

spt.interrupt();
boolean interrupted = spt.isInterrupted();
spt = null;
System.out.println("Spt is interrupted is " + interrupted);

segmentPlaying = false;
}
}